The DisplayMediaStreamConstraints dictionary's video property is used to configure the video track in the stream returned by getDisplayMedia(). This value may be a Boolean, where true specifies that a default selection of input source be made (typically the entire display area of the device in use, spanning every screen in a multiple screen configuration). Since a video track must always be included, a value of false results in a TypeError exception being thrown.

More precise control over the format of the returned video track may be exercised by instead providing a MediaTrackConstraints object, which is used to process the video data after obtaining it from the device but prior to adding it to the stream.


displayMediaStreamConstraints.video = allowVideoFlag;
displayMediaStreamConstraints.video = mediaTrackConstraints;

displayMediaStreamConstraints = {
  video: allowVideoFlag | mediaTrackConstraints;


The value may be either a Boolean or a MediaTrackConstraints object.

If a Boolean is specified, a value of true (the default) indicates that the stream returned by getDisplayMedia() should be in whatever format the user agent feels is best. A value of false is not permitted and will throw a TypeError.

If a MediaTrackConstraints object is given instead, the video track will be processed to match the settings given in the constraints object.

Constraints specific to screen sharing

{{page("/en-US/docs/Web/API/MediaTrackConstraints", "Properties of shared screen tracks")}}



Specification Status Comment
Screen Capture
The definition of 'DisplayMediaStreamConstraints.video' in that specification.
Working Draft Initial definition

Browser compatibility

No compatibility data found for api.DisplayMediaStreamConstraints.video.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.

See also