Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

MediaStreamConstraints

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

The MediaStreamConstraints dictionary is used when calling getUserMedia() to specify what kinds of tracks should be included in the returned MediaStream, and, optionally, to establish constraints for those tracks' settings.

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.

Track constraints

video
Either a Boolean (which indicates whether or not a video track is requested) or a MediaTrackConstraints object providing the constraints which must be met by the video track included in the returned MediaStream. If constraints are specified, a video track is inherently requested.
audio
Either a Boolean (which indicates whether or not an audio track is requested) or a MediaTrackConstraints object providing the constraints which must be met by the audio track included in the returned MediaStream. If constraints are specified, an audio track is inherently requested.

Security

peerIdentity
A DOMString identifying the peer who has sole access to the stream. If this property is specified, only the indicated peer can receive and use the stream. Streams isolated in this way can only be displayed in a media element (<audio> or <video>) where the content is protected just as if CORS cross-origin rules were in effect.

Browser compatibility

Feature Chrome Firefox (Gecko) Microsoft Edge Internet Explorer Opera Safari
Basic support 53.0 38 (38) ? No support (Yes) ?
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? 53.0 38.0 (38) No support ? ? 53.0

See also

文档标签和贡献者

 此页面的贡献者: Sheppy
 最后编辑者: Sheppy,