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.
Some or all of the following will be included in the object.
deviceId
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
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()
.autoGainControl
autoGainControl
property, which is true
if automatic gain control is enabled and is false
otherwise.channelCount
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
echoCancellation
property, specifying true
if echo cancellation is enabled, otherwise false
.latency
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
noiseSupression
property, which is true
if noise suppression is enabled and is false
otherwise.sampleRate
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
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
volume
property, specifying the volume level of the track. This value will be between 0.0 (silent) to 1.0 (maximum supported volume).aspectRatio
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 televison 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
DOMString
indicating the current value of the facingMode
property, specifying the direction the camera is facing. The value will be one of: "user"
"environment"
"left"
"right"
frameRate
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
height
property, specifying the height of the track's video data in pixels.width
width
property, specifying the width of the track's video data in pixels.MediaDevices.getUserMedia()
MediaStreamTrack.getConstraints()
MediaStreamTrack.applyConstraints()
MediaStreamTrack.getSettings()
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings