W3cubDocs

/Web APIs

MediaTrackSupportedConstraints

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.

Instance properties

Some combination—but not necessarily all—of the following properties will exist on the object.

autoGainControl

A Boolean whose value is true if the autoGainControl constraint is supported in the current environment.

width

A Boolean value whose value is true if the width constraint is supported in the current environment.

height

A Boolean value whose value is true if the height constraint is supported in the current environment.

aspectRatio

A Boolean value whose value is true if the aspectRatio constraint is supported in the current environment.

frameRate

A Boolean value whose value is true if the frameRate constraint is supported in the current environment.

facingMode

A Boolean value whose value is true if the facingMode constraint is supported in the current environment.

resizeMode

A Boolean value whose value is true if the resizeMode constraint is supported in the current environment.

volume Deprecated Non-standard

A Boolean value whose value is true if the volume constraint is supported in the current environment.

sampleRate

A Boolean value whose value is true if the sampleRate constraint is supported in the current environment.

sampleSize

A Boolean value whose value is true if the sampleSize constraint is supported in the current environment.

echoCancellation

A Boolean value whose value is true if the echoCancellation constraint is supported in the current environment.

latency

A Boolean value whose value is true if the latency constraint is supported in the current environment.

noiseSuppression

A Boolean whose value is true if the noiseSuppression constraint is supported in the current environment.

channelCount

A Boolean value whose value is true if the channelCount constraint is supported in the current environment.

deviceId

A Boolean value whose value is true if the deviceId constraint is supported in the current environment.

groupId

A Boolean value whose value is true if the groupId constraint is supported in the current environment.

Instance 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.

displaySurface

A Boolean value which is true if the displaySurface constraint is supported in the current environment.

logicalSurface

A Boolean value which is true if the logicalSurface constraint is supported in the current environment.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
MediaTrackSupportedConstraints 52 ≤79 42 No 39 11 52 52 42 41 11 6.0
aspectRatio 52 ≤79 No No 39 11 52 52 No 41 11 6.0
autoGainControl 69 ≤79 5546–55 No 56 No 69 69 5546–55 48 No 10.0
channelCount 52 ≤79 56 No 39 11 52 52 56 41 11 6.0
deviceId 52 ≤79 42 No 39 11 52 52 42 41 11 6.0
displaySurface 107 107 No No 93 11.1 107 107 No 73 11.3 21.0
echoCancellation 52 ≤79 46 No 39 11 52 52 46 41 11 6.0
facingMode 52 ≤79 42 No 39 11 52 52 42 41 11 6.0
frameRate 52 ≤79 42 No 39 11 52 52 42 41 11 6.0
groupId 52 ≤79 70 No 39 11 52 52 No 41 11 6.0
height 52 ≤79 42 No 39 11 52 52 42 41 11 6.0
latency 52 ≤79 No No 39 11 52 52 No 41 11 6.0
logicalSurface No No No No No 11.1 No No No No 11.3 No
noiseSuppression 69 ≤79 5546–55 No 56 No 69 69 5546–55 48 No 10.0
resizeMode 72 79 No No 60 No 72 72 No 51 No 11.0
sampleRate 52 ≤79 No No 39 11 52 52 No 41 11 6.0
sampleSize 52 ≤79 No No 39 11 52 52 No 41 11 6.0
suppressLocalAudioPlayback 109 109 No No 95 No 109 109 No 74 No 21.0
volume 52 ≤79 No No 39 11 52 52 No 41 11 6.0
width 52 ≤79 42 No 39 11 52 52 42 41 11 6.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints