The MediaTrackSupportedConstraints dictionary establishes the list of constrainable properties recognized by the user agent or browser in its implementation of the MediaStreamTrack object. An object conforming to MediaTrackSupportedConstraints is returned by MediaDevices.getSupportedConstraints().
Because of the way interface definitions in WebIDL work, if a constraint is requested but not supported, no error will occur. Instead, the specified constraints will be applied, with any unrecognized constraints stripped from the request.That can lead to confusing and hard to debug errors, so be sure to use getSupportedConstraints() to retrieve this information before attempting to establish constraints if you need to know the difference between silently ignoring a constraint and a constraint being accepted.
An actual constraint set is described using an object based on the MediaTrackConstraints dictionary.
To learn more about how constraints work, see Capabilities, constraints, and settings.
Properties
Some combination—but not necessarily all—of the following properties will exist on the object.
autoGainControl- A Boolean whose value is
trueif theautoGainControlconstraint is supported in the current environment. width- A Boolean value whose value is
trueif thewidthconstraint is supported in the current environment. height- A Boolean value whose value is
trueif theheightconstraint is supported in the current environment. aspectRatio- A Boolean value whose value is
trueif theaspectRatioconstraint is supported in the current environment. frameRate- A Boolean value whose value is
trueif theframeRateconstraint is supported in the current environment. facingMode- A Boolean value whose value is
trueif thefacingModeconstraint is supported in the current environment. resizeMode- A Boolean value whose value is
trueif theresizeModeconstraint is supported in the current environment. volume- A Boolean value whose value is
trueif thevolumeconstraint is supported in the current environment. sampleRate- A Boolean value whose value is
trueif thesampleRateconstraint is supported in the current environment. sampleSize- A Boolean value whose value is
trueif thesampleSizeconstraint is supported in the current environment. echoCancellation- A Boolean value whose value is
trueif theechoCancellationconstraint is supported in the current environment. latency- A Boolean value whose value is
trueif thelatencyconstraint is supported in the current environment. noiseSuppression- A Boolean whose value is
trueif thenoiseSuppressionconstraint is supported in the current environment. channelCount- A Boolean value whose value is
trueif thechannelCountconstraint is supported in the current environment. deviceId- A Boolean value whose value is
trueif thedeviceIdconstraint is supported in the current environment. groupId- A Boolean value whose value is
trueif thegroupIdconstraint is supported in the current environment.
Properties specific to shared screen tracks
For tracks containing video sources from the user's screen contents, the following additional properties are may be included in addition to those available for video tracks.
cursor-
A Boolean value which is
trueif thecursorconstraint is supported in the current environment. displaySurface-
A Boolean value which is
trueif thecursorconstraint is supported in the current environment. logicalSurface- A Boolean value which is
trueif thelogicalSurfaceconstraint is supported in the current environment.
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
MediaTrackSupportedConstraints | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
aspectRatio | Chrome Full support 52 | Edge Full support ≤79 | Firefox No support No | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
autoGainControl | Chrome Full support 69 | Edge Full support ≤79 | Firefox
Full support
55
| IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 69 | Chrome Android Full support 69 | Firefox Android
Full support
55
| Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 10.0 |
channelCount | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 56 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 56 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
cursor | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera Full support Yes | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
deviceId | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
displaySurface | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera Full support Yes | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
echoCancellation | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 46 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 46 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
facingMode | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
frameRate | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
groupId | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 70 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
height | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
latency | Chrome Full support 52 | Edge Full support ≤79 | Firefox No support No | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
logicalSurface | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera Full support Yes | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
noiseSuppression | Chrome Full support 69 | Edge Full support ≤79 | Firefox
Full support
55
| IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 69 | Chrome Android Full support 69 | Firefox Android
Full support
55
| Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 10.0 |
resizeMode | Chrome No support No | Edge No support No | Firefox No support No | IE ? | Opera No support No | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS ? | Samsung Internet Android No support No |
sampleRate | Chrome Full support 52 | Edge Full support ≤79 | Firefox No support No | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
sampleSize | Chrome Full support 52 | Edge Full support ≤79 | Firefox No support No | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
volume | Chrome Full support 52 | Edge Full support ≤79 | Firefox No support No | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
width | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 42 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 42 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 6.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.
