MediaTrackSupportedConstraints - Web APIs 编辑
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
true
if theautoGainControl
constraint is supported in the current environment. width
- A Boolean value whose value is
true
if thewidth
constraint is supported in the current environment. height
- A Boolean value whose value is
true
if theheight
constraint is supported in the current environment. aspectRatio
- A Boolean value whose value is
true
if theaspectRatio
constraint is supported in the current environment. frameRate
- A Boolean value whose value is
true
if theframeRate
constraint is supported in the current environment. facingMode
- A Boolean value whose value is
true
if thefacingMode
constraint is supported in the current environment. resizeMode
- A Boolean value whose value is
true
if theresizeMode
constraint is supported in the current environment. volume
- A Boolean value whose value is
true
if thevolume
constraint is supported in the current environment. sampleRate
- A Boolean value whose value is
true
if thesampleRate
constraint is supported in the current environment. sampleSize
- A Boolean value whose value is
true
if thesampleSize
constraint is supported in the current environment. echoCancellation
- A Boolean value whose value is
true
if theechoCancellation
constraint is supported in the current environment. latency
- A Boolean value whose value is
true
if thelatency
constraint is supported in the current environment. noiseSuppression
- A Boolean whose value is
true
if thenoiseSuppression
constraint is supported in the current environment. channelCount
- A Boolean value whose value is
true
if thechannelCount
constraint is supported in the current environment. deviceId
- A Boolean value whose value is
true
if thedeviceId
constraint is supported in the current environment. groupId
- A Boolean value whose value is
true
if thegroupId
constraint 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
true
if thecursor
constraint is supported in the current environment.displaySurface
A Boolean value which is
true
if thecursor
constraint is supported in the current environment.logicalSurface
- A Boolean value which is
true
if thelogicalSurface
constraint is supported in the current environment.
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论