getDefaultDegradationPreference function
- TrackSource source
Returns the degradation preference to use for a video track published under
source, when the application did not set one explicitly.
- Camera: DegradationPreference.maintainFramerate (smoother video for real-time communication)
- Screen share: DegradationPreference.maintainResolution (clarity is critical for reading text/UI)
- Other/unknown: DegradationPreference.balanced
Any other source means the application declined to declare a motion-vs-detail intent, so this falls back to balanced, the preference the WebRTC spec mandates as the default.
Implementation
DegradationPreference getDefaultDegradationPreference(TrackSource source) {
switch (source) {
case TrackSource.camera:
return DegradationPreference.maintainFramerate;
case TrackSource.screenShareVideo:
return DegradationPreference.maintainResolution;
default:
return DegradationPreference.balanced;
}
}