The mediaConstraints dictionary is non-standard and was either used to control features which now have a standard API or to control legacy features that have either been removed or are about to be removed.
As of M102, some constraints are removed and others emit deprecation warnings.
The plan is to ignore/remove all constraints listed below in the M103-M104 time frame.
Deprecation by use cases
The RTCPeerConnection constructor's mediaConstraints:
- Constraints now emitting a deprecation warning that will soon be ignored:
- googCpuOveruseDetection: Already enabled-by-default. Being able to set this to false will soon be removed.
- googIPv6: Already enabled-by-default. Being able to set this to false will soon be removed.
- googScreencastMinBitrate: The default behavior is now the same as setting this to 100. Setting it to anything else will soon be removed.
- googSuspendBelowMinBitrate: Disabled-by-default and ability to set it to true will soon be removed.
- Constraints that used to do something that now are ignored:
- googDscp: Setting this to true was previously a prerequisite for using any value of RTCRtpEncodingParameters.networkPriority other than the default value "low". As of M102, googDscp is no longer needed to control networkPriority and setting it to false is not possible.
- The following constraints were already not wired up to anything (were NO-OPs) and are now ignored by the parser (using them will now cause a warning):
RTCPeerConnection.createOffer() and createAnswer()'s use of mediaConstraints:
- The callback-based versions of these methods (which are non-standard) used mediaConstraints to control OfferToReceiveAudio, OfferToReceiveVideo, IceRestart and VoiceActivityDetection. Using these will now emit a deprecation warning and they will soon be removed.
- Use the spec-compliant promise-based versions of these methods instead. The RTCOfferOptions and RTCAnswerOptions argument contains spec-compliant equivalents (notice lower casing): offerToReceiveAudio, offerToReceiveVideo, iceRestart and voiceActivityDetection.
RTCPeerConnection.addStream()'s use of mediaConstraints is now removed. It was previously parsed but none of the constraints had any effect.
mediaConstraints are also used by getUserMedia(). Usage is discouraged (please use spec-compliant constraints instead) but deprecation of these is not happening yet due to high usage counts. We should revisit this in the future.
Happy spring cleaning,