Since builds WCS 5.2.1663 and SFU SDK 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 state.setDisplay(initRemoteDisplay({ div: document.getElementById("remoteVideo"), room: state.room, peerConnection: state.pc, displayOptions: { publisher: false, quality: true, type: false, abr: true, abrKeepOnGoodQuality: 20000, abrTryForUpperQuality: 30000 } })); // Start WebRTC negotiation await state.room.join(state.pc);
Where:
- abr - enables or disables automatic quality switching
- abrKeepOnGoodQuality - interval in milliseconds to play a current video quality if there are no WebRTC statistics data leaps
- abrTryForUpperQuality - after this interval in milliseconds player will try to switch to a higher available video quality if there are no WebRTC statistics data leaps
If any quality is manually chosen, it will be playing even if WebRTC statistics values are bad.