Don sarrafa ingancin kafofin watsa labarai tare da Mediasoup-client, zaku iya bin waɗannan matakan:
Sanya Transpor
Lokacin ƙirƙirar Transport
, zaku iya ƙirƙira saiti masu alaƙa da ingancin mai jarida.
Misali, zaku iya amfani da sigogi kamar maxBitrate
iyakance matsakaicin matsakaicin bitrate don rafukan mai jarida.
const transport = await device.createSendTransport({
// Transport configuration
maxBitrate: 500000 // Limit maximum bitrate to 500kbps
});
Daidaita Producer
Kanfigareshan
Lokacin ƙirƙirar Producer
, zaku iya daidaita tsarin don sarrafa ingancin mai jarida.
Misali, zaku iya amfani da sigogi kamar maxBitrate
ko scaleResolutionDownBy
don iyakance bitrate ko auna saukar da ƙudurin rafukan watsa labarai.
const producer = await transport.produce({
kind: 'video',
// Producer configuration
maxBitrate: 300000, // Limit maximum bitrate to 300kbps
scaleResolutionDownBy: 2 // Scale down resolution by 1/2
});
Daidaita Consumer
Kanfigareshan
Lokacin ƙirƙirar Consumer
, zaku iya daidaita tsarin don sarrafa ingancin mai jarida.
Misali, zaku iya amfani da sigogi kamar preferredCodec
ba da fifiko ga takamaiman codec ko preferredBitrate
don buƙatar fitaccen bitrate don rafukan watsa labarai.
const consumer = await transport.consume({
// Consumer configuration
preferredCodec: 'h264', // Prefer using H.264 codec
preferredBitrate: 500000 // Request preferred bitrate of 500kbps
});
Saka idanu abubuwan da ke faruwa da Sarrafa
Mediasoup-client yana ba da abubuwan da suka faru kamar producer
, consumer
, downlinkBwe
da kuma uplinkBwe
cewa za ku iya saka idanu da rike don sarrafa ingancin mai jarida.
Misali, zaku iya sauraron taron 'uplinkBwe' don daidaita inganci dangane da bandwidth na sama.
transport.on('uplinkBwe',(event) => {
const targetBitrate = event.targetBitrate;
// Adjust quality based on uplink bandwidth
});
Lura cewa ƙayyadaddun hanya don sarrafa ingancin kafofin watsa labarai da abubuwan da ke akwai na iya bambanta dangane da buƙatu da yanayin aikace-aikacenku. Koma zuwa Mediasoup-client takaddun don ƙarin koyo game da daidaitawa da abubuwan da suka dace don daidaita ingancin kafofin watsa labarai gwargwadon bukatunku.