Video ABR playback using WebRTC statistics data¶
Since WCS build 5.2.1663 and SFU SDK build 2.0.231 player may switch between available ABR qualities automatically when playback channel state is changing. Automatic quality switching is based on the following WebRTC playback statistics data.
- nackCount
- freezeCount
- packetsLost
If any of these parameters leaps more than 10 points above, the channels is considered to be inappropriate to play a current video quality, and player will try to switch to a lower available quality.
Automatic quality switching parameters are set when calling initRemoteDisplay()
function:
// Create remote display item to show remote streams
const displayOptions = {
quality:true,
autoAbr: true
};
const abrOptions = {
thresholds: [
{parameter: "nackCount", maxLeap: 10},
{parameter: "freezeCount", maxLeap: 10},
{parameter: "packetsLost", maxLeap: 10}
],
abrKeepOnGoodQuality: ABR_KEEP_ON_QUALITY,
abrTryForUpperQuality: ABR_TRY_UPPER_QUALITY,
interval: ABR_QUALITY_CHECK_PERIOD
};
const display = initRemoteDisplay(
state.room,
document.getElementById("remoteVideo"),
displayOptions, abrOptions,
createDefaultMeetingController,
createDefaultMeetingModel,
createDefaultMeetingView,
oneToOneParticipantFactory(remoteTrackProvider(state.room))
);
state.setDisplay(display);
// Start WebRTC negotiation
await state.room.join(state.pc, null, null, 1);
Where:
abrKeepOnGoodQuality
- interval in milliseconds to play a current video quality if there are no WebRTC statistics data leapsabrTryForUpperQuality
- after this interval in milliseconds player will try to switch to a higher available video quality if there are no WebRTC statistics data leapsinterval
- WebRTC statistics data collection interval in milliseconds
If any quality is manually chosen, it will be playing even if WebRTC statistics values are bad.