AvailableOutgoingBitrate works by reporting the current available bandwidth for outgoing media in a WebRTC session. WebRTC dynamically monitors network conditions and adjusts the bitrate to match the available bandwidth.
• How it works: It monitors the network’s capacity to send media and adjusts the media quality (e.g., video resolution) to fit within the available bandwidth.
• Value type: The value is a number (in bits per second), representing the available bandwidth for sending media. To get kb/s just.
// Assuming you have a publisher object
const publisher = OT.initPublisher('publisherElementId', {
insertMode: 'append',
width: '100%',
height: '100%'
});
// Get stats every few seconds (adjust as necessary)
setInterval(() = {
publisher.getStats((error, statsArray) = {
if (error) {
console.error('Error getting stats: ', error);
return;
}
statsArray.forEach((stats) = {
if (stats.hasOwnProperty('availableOutgoingBitrate')) {
console.log('Available Outgoing Bitrate: ', stats.availableOutgoingBitrate);
}
});
});
}, 5000); // Check every 5 seconds
From this vlaue