A MediaStreamConstraints object specifying the types of media to request, along with any requirements for each type.
The constraints
parameter is an object with two members: video and audio, describing the media types requested. Either or both must be specified. If the browser cannot find all media tracks with the specified types that meet the constraints given, then the returned promise is rejected with NotFoundError
DOMException.
For both video
and audio
, its value is either a boolean or an object. The default value is false.
If true
is specified for a media type, the resulting stream is required to have that type of track in it. If one cannot be included for any reason, the returned promise will reject.
If false
is specified for a media type, the resulting stream must not have that type of track, or the returned promise will reject. Because both video
and audio
default to false
, if the constraints object contains
neither property or if it's not present at all, the returned promise will always reject.
If an object is specified for a media type, the object is read as a MediaTrackConstraints dictionary.
Options to publish a stream with a specific MediaStreamConstraints object.