MediaTrackSupportedConstraints: suppressLocalAudioPlayback property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The MediaTrackSupportedConstraints dictionary's suppressLocalAudioPlayback property indicates whether or not the suppressLocalAudioPlayback constraint is supported by the user agent and the device on which the content is being used.

The supported constraints list is obtained by calling navigator.mediaDevices.getSupportedConstraints().

Value

A boolean value which is true if the suppressLocalAudioPlayback constraint is supported by the device and user agent.

Examples

The function below sets up the options object for the call to getDisplayMedia(). It adds the suppressLocalAudioPlayback constraint (requesting that captured audio is not played out of the user's local speakers) only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem.

js
async function capture() {
  const supportedConstraints = navigator.mediaDevices.getSupportedConstraints();
  const displayMediaOptions = {
    audio: {},
  };

  if (supportedConstraints.suppressLocalAudioPlayback) {
    displayMediaOptions.audio.suppressLocalAudioPlayback = true;
  }

  try {
    videoElem.srcObject =
      await navigator.mediaDevices.getDisplayMedia(displayMediaOptions);
  } catch (err) {
    /* handle the error */
  }
}

Specifications

Specification
Screen Capture
# dom-mediatrackconstraintset-suppresslocalaudioplayback

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
suppressLocalAudioPlayback constraint
Experimental
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

See also