Musamman da Extensibility tare da Mediasoup-client

Don keɓancewa da tsawaita Mediasoup-client, kuna iya bin waɗannan matakan:

Transport Keɓance Kanfigareshan

Lokacin ƙirƙirar Transport, zaku iya keɓance saiti kamar rtcMinPort kuma rtcMaxPort don ayyana kewayon tashar jiragen ruwa da ake amfani da su don haɗin RTC(Sadarwar-Lokaci ta Gaskiya)

const worker = await mediasoup.createWorker();  
const router = await worker.createRouter({ mediaCodecs });  
const transport = await router.createWebRtcTransport({  
  listenIps: [{ ip: '0.0.0.0', announcedIp: YOUR_PUBLIC_IP }],  
  rtcMinPort: 10000,  
  rtcMaxPort: 20000  
});  

 

Ƙirƙiri Na Musamman Producer kuma Consumer

Kuna iya ƙirƙirar da aka keɓance Producer kuma Consumer don sarrafa abubuwa kamar codecs, ƙuduri, bitrates, da ƙari.

Misali, don ƙirƙirar Producer codec na VP9 da ƙudurin 720p, zaku iya amfani da:

const producer = await transport.produce({  
  kind: 'video',  
  rtpParameters: {  
    codecMimeType: 'video/VP9',  
    encodings: [{ maxBitrate: 500000 }],  
    // ... other parameters  
  },  
  // ... other options  
});  

 

Yi amfani da Plugins

Mediasoup-client yana ba ku damar amfani da plugins don tsawaita aikinsa.

Misali, zaku iya ƙirƙirar plugin don sarrafa dabaru na al'ada lokacin da aka ƙirƙira Producer ko Consumer aka ƙirƙira. Ga misali mai sauƙi na ƙirƙirar plugin don sarrafa Producer abubuwan da suka faru:

const MyProducerPlugin = {  
  name: 'myProducerPlugin',  
  onProducerCreated(producer) {  
    console.log('A new producer was created:', producer.id);  
    // Perform custom logic here  
  },  
};  
  
mediasoupClient.use(MyProducerPlugin);  

 

Yi Amfani da Nagartattun Fasaloli

Mediasoup-client yana ba da fasali na ci gaba kamar Simulcast, SVC(Scalable Video Codeing), Sarrafa Matsayin Sauti, da ƙari. Kuna iya bincika da amfani da su bisa ga buƙatun aikinku.

Misali, don amfani da fasalin Simulcast, zaku iya ƙirƙirar Producer tare da yadudduka daban-daban na sarari da na ɗan lokaci:

const producer = await transport.produce({  
  kind: 'video',  
  simulcast: [  
    { spatialLayer: 0, temporalLayer: 2 },  
    { spatialLayer: 1, temporalLayer: 1 },  
    { spatialLayer: 2, temporalLayer: 1 },  
  ],  
  // ... other options  
});  

 

Keɓancewa da haɓakawa Mediasoup-client yana ba ku damar sarrafawa da keɓance bangarori daban-daban na sadarwa ta ainihi a cikin aikace-aikacenku. Ta hanyar amfani da jeri, plugins, da abubuwan ci-gaba, zaku iya ƙirƙirar ƙwarewar da ta dace wacce ta dace da takamaiman buƙatun aikinku.