coderef

Screen captureLimited availability

The navigator.mediaDevices.getDisplayMedia() method asks the user to choose a screen or portion of a screen (such as a window) to capture as a media stream.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–71Not supported
72+Supportedsince Jan 29, 2019
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–32Not supported
33+Supportedsince Oct 14, 2014
Current: 157
Safari
1–12.1Not supported
13+Supportedsince Sep 19, 2019
Current: 27
MobileChrome Android
✕Not supportedup to 155
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Chrome Android, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: CaptureController.

Feature detection

JS · check before using
if ("CaptureController" in globalThis) {
  // CaptureController is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (15). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
CaptureController109109✕✕✕✕✕
CaptureController.CaptureController109109✕✕✕✕✕
CaptureController.setFocusBehavior109109✕✕✕✕✕
MediaDevices.getDisplayMedia72793313✕✕✕
MediaDevices.getDisplayMedia.audio_capture_support7479✕✕✕✕✕
MediaDevices.getDisplayMedia.controller_option109109✕✕✕✕✕
MediaDevices.getDisplayMedia.monitorTypeSurfaces_option119119✕✕✕✕✕
MediaDevices.getDisplayMedia.selfBrowserSurface_option112112✕✕✕✕✕
MediaDevices.getDisplayMedia.surfaceSwitching_option107107✕✕✕✕✕
MediaDevices.getDisplayMedia.systemAudio_option105105✕✕✕✕✕
MediaStreamTrack.applyConstraints.displaySurface_constraint107107✕11.1107✕11.3
MediaStreamTrack.applyConstraints.logicalSurface_constraint✕✕✕11.1✕✕11.3
MediaStreamTrack.applyConstraints.suppressLocalAudioPlayback_constraint109109✕✕109✕✕
iframe.allow.display-capture9494741394✕✕
http.headers.Permissions-Policy.display-capture9494✕✕94✕✕