Web/API/MediaTrackSettings

From Get docs


The MediaTrackSettings dictionary is used to return the current values configured for each of a MediaStreamTrack's settings. These values will adhere as closely as possible to any constraints previously described using a MediaTrackConstraints object and set using applyConstraints(), and will adhere to the default constraints for any properties whose constraints haven't been changed, or whose customized constraints couldn't be matched.

To learn more about how constraints and settings work, see Capabilities, constraints, and settings.

Properties

Some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context. For example, because RTP doesn't provide some of these values during negotiation of a WebRTC connection, a track associated with a RTCPeerConnection will not include certain values, such as facingMode or groupId.

Properties of all media tracks

deviceId
A DOMString indicating the current value of the deviceId property. The device ID is a origin-unique string identifying the source of the track; this is usually a GUID. This value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling MediaDevices.getUserMedia().
groupId
A DOMString indicating the current value of the groupId property. The group ID is a browsing session-unique string identifying the source group of the track. Two devices (as identified by the deviceId) are considered part of the same group if they are from the same physical device. For instance, the audio input and output devices for the speaker and microphone built into a phone would share the same group ID, since they're part of the same physical device. The microphone on a headset would have a different ID, though. This value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling MediaDevices.getUserMedia().

Properties of audio tracks

autoGainControl
A Boolean which indicates the current value of the autoGainControl property, which is true if automatic gain control is enabled and is false otherwise.
channelCount
A long integer value indicating the current value of the channelCount property, specifying the number of audio channels present on the track (therefore indicating how many audio samples exist in each audio frame). This is 1 for mono, 2 for stereo, and so forth.
echoCancellation
A Boolean indicating the current value of the echoCancellation property, specifying true if echo cancellation is enabled, otherwise false.
latency
A double-precision floating point value indicating the current value of the latency property, specifying the audio latency, in seconds. Latency is the amount of time which elapses between the start of processing the audio and the data being available to the next stop in the audio utilization process. This value is a target value; actual latency may vary to some extent for various reasons.
noiseSuppression
A Boolean which indicates the current value of the noiseSuppression property, which is true if noise suppression is enabled and is false otherwise.
sampleRate
A long integer value indicating the current value of the sampleRate property, specifying the sample rate in samples per second of the audio data. Standard CD-quality audio, for example, has a sample rate of 41,000 samples per second.
sampleSize
A long integer value indicating the current value of the sampleSize property, specifying the linear size, in bits, of each audio sample. CD-quality audio, for example, is 16-bit, so this value would be 16 in that case.
volume
A double-precision floating point value indicating the current value of the volume property, specifying the volume level of the track. This value will be between 0.0 (silent) to 1.0 (maximum supported volume).

Properties of video tracks

aspectRatio
A double-precision floating point value indicating the current value of the aspectRatio property, specified precisely to 10 decimal places. This is the width of the image in pixels divided by its height in pixels. Common values include 1.3333333333 (for the classic television 4:3 "standard" aspect ratio, also used on tablets such as Apple's iPad), 1.7777777778 (for the 16:9 high-definition widescreen aspect ratio), and 1.6 (for the 16:10 aspect ratio common among widescreen computers and tablets).
facingMode
A DOMString indicating the current value of the facingMode property, specifying the direction the camera is facing. The value will be one of:
"user"
A camera facing the user (commonly known as a "selfie cam"), used for self-portraiture and video calling.
"environment"
A camera facing away from the user (when the user is looking at the screen). This is typically the highest quality camera on the device, used for general photography.
"left"
A camera facing toward the environment to the user's left.
"right"
A camera facing toward the environment to the user's right.
frameRate
A double-precision floating point value indicating the current value of the frameRate property, specifying how many frames of video per second the track includes. If the value can't be determined for any reason, the value will match the vertical sync rate of the device the user agent is running on.
height
A long integer value indicating the current value of the height property, specifying the height of the track's video data in pixels.
width
A long integer value indicating the current value of the width property, specifying the width of the track's video data in pixels.
resizeMode
A DOMString indicating the current value of the resizeMode property, specifying the mode used by the user agent to derive the resolution of the track. The value will be one of:
"none"
The track has the resolution offered by the camera, its driver or the OS.
"crop-and-scale"
The track's resolution might be the result of the user agent using cropping or downscaling from a higher camera resolution.

Properties of shared screen tracks

Tracks containing video shared from a user's screen (regardless of whether the screen data comes from the entire screen or a portion of a screen, like a window or tab) are generally treated like video tracks, with the exception that they also support the following added settings:

cursor
A DOMString which indicates whether or not the mouse cursor is being included in the generated stream and under what conditions. Possible values are:
always
The mouse is always visible in the video content of the {domxref("MediaStream"), unless the mouse has moved outside the area of the content.
motion
The mouse cursor is always included in the video if it's moving, and for a short time after it stops moving.
never
The mouse cursor is never included in the shared video.
displaySurface
A DOMString which specifies the type of source the track contains; one of:
application
The stream contains all of the windows of the application chosen by the user rendered into the one video track.
browser
The stream contains the contents of a single browser tab selected by the user.
monitor
The stream's video track contains the entire contents of one or more of the user's screens.
window
The stream contains a single window selected by the user for sharing.
logicalSurface
A Boolean value which, if true, indicates that the video contained in the stream's video track contains a background rendering context, rather than a user-visible one. This is false if the video being captured is coming from a foreground (user-visible) source.

Specifications

Specification Status Comment
Screen CaptureThe definition of 'MediaTrackSettings' in that specification. Working Draft Initial definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
MediaTrackSettings Chrome

Full support 59

Edge

Full support ≤79

Firefox

Full support Yes

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 59

Chrome Android

Full support 59

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support 7.0

aspectRatio Chrome

Full support Yes

Edge

Full support ≤79

Firefox

No support No

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

autoGainControl Chrome

Full support Yes

Edge

Full support ≤79

Firefox Full support 55


Full support 55


No support 50 — 55

Prefixed'

Prefixed' Implemented with the vendor prefix: moz

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android Full support 55


Full support 55


No support 50 — 55

Prefixed'

Prefixed' Implemented with the vendor prefix: moz

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

channelCount Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

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

cursor Chrome

Full support 71

Edge

Full support ≤79

Firefox

No support No

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 71

Chrome Android

Full support 71

Firefox Android

No support No

Opera Android

?

Safari iOS

?

Samsung Internet Android

Full support 10.0

deviceId Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 69

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

displaySurface Chrome

Full support 71

Edge

Full support ≤79

Firefox

No support No

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 71

Chrome Android

Full support 71

Firefox Android

No support No

Opera Android

?

Safari iOS

?

Samsung Internet Android

Full support 10.0

echoCancellation Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 50

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 50

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

facingMode Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 69

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

frameRate Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 36

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 36

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

groupId Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 69

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

height Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 36

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 36

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

latency Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

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

logicalSurface Chrome

Full support 71

Edge

Full support ≤79

Firefox

No support No

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 71

Chrome Android

Full support 71

Firefox Android

No support No

Opera Android

?

Safari iOS

?

Samsung Internet Android

Full support 10.0

noiseSuppression Chrome

Full support Yes

Edge

Full support ≤79

Firefox Full support 55


Full support 55


No support 50 — 55

Prefixed'

Prefixed' Implemented with the vendor prefix: moz

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android Full support 55


Full support 55


No support 50 — 55

Prefixed'

Prefixed' Implemented with the vendor prefix: moz

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

resizeMode Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

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

No support No

Edge

No support No

Firefox

No support No

IE

No support No

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

sampleSize Chrome

Full support Yes

Edge

Full support ≤79

Firefox

No support No

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

volume

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

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

width Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support 36

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 36

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

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.


See also