The DisplayMediaStreamConstraints dictionary's audio property is used to specify whether or not to request that the MediaStream containing screen display contents also include an audio track. This value may be a Boolean, where true indicates that an audio track should be included an false (the default) indicates that no audio should be included in the stream.

More precise control over the audio data may be exercised by instead providing a MediaTrackConstraints object, which is used to process the audio prior to adding it to the stream.

Note: The specification for the Screen Capture API does not define what the contents of the audio track should be. This is left up to the user agent to decide. Likely sources are the computer's system audio output and the user's microphone, but there is no way to specify which source to use.


displayMediaStreamConstraints.audio = allowAudioFlag;
displayMediaStreamConstraints.audio = mediaTrackConstraints;

displayMediaStreamConstraints = {
  audio: allowAudioFlag|mediaTrackConstraints;


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

If a Boolean is specified, a value of true indicates that an audio track should be included in the stream returned by getDisplayMedia(), if an appropriate audio source exists and the user agent supports audio on display media. A value of false—the default—indicates that no audio track is to be included in the stream.

If a MediaTrackConstraints object is given, and an audio source is available, an audio track matching the settings given in the constraints object is included in the MediaStream returned by getDisplayMedia().

If no audio source is available, or the user agent doesn't support audio tracks with getDisplayMedia(), the returned MediaStream has no audio track, but no error occurs. The audio track is always considered optional.



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

Browser compatibility

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

See also