Screen Capture API

The Screen Capture API introduces additions to the existing Media Capture and Streams API to let the user select a screen or portion of a screen (such as a window) to capture as a media stream. This stream can then be recorded or shared with others over the network.

Screen Capture API concepts and usage

The Screen Capture API is relatively simple to use. Its main method is MediaDevices.getDisplayMedia(), whose job is to ask the user to select a screen or portion of a screen to capture in the form of a MediaStream.

To start capturing video from the screen, you call getDisplayMedia() on navigator.mediaDevices:

js
captureStream =
  await navigator.mediaDevices.getDisplayMedia(displayMediaOptions);

The Promise returned by getDisplayMedia() resolves to a MediaStream which streams the captured display surface.

See the article Using the Screen Capture API for a more in-depth look at how to use the API to capture screen contents as a stream.

Screen capture extensions

The Screen Capture API has additional features that extend its capabilities:

Limiting the screen area captured in the stream

  • The Element Capture API restricts the captured region to a specified rendered DOM element and its descendants.
  • The Region Capture API crops the captured region to the area of the screen in which a specified DOM element is rendered.

See Using the Element Capture and Region Capture APIs to learn more.

Controlling the captured screen area

The Captured Surface Control API allows the capturing application to provide limited control over the captured display surface, for example zooming and scrolling its contents.

See Using the Captured Surface Control API to learn more.

Interfaces

BrowserCaptureMediaStreamTrack

Represents a single video track; extends the MediaStreamTrack class with methods to limit the part of a self-capture stream (for example, a user's screen or window) that is captured.

CaptureController

Provides methods that can be used to further manipulate a captured display surface (captured via MediaDevices.getDisplayMedia()). A CaptureController object is associated with a captured display surface by passing it into a getDisplayMedia() call as the value of the options object's controller property.

CropTarget

Provides a static method, fromElement(), which returns a CropTarget instance that can be used to crop a captured video track to the area in which a specified element is rendered.

RestrictionTarget

Provides a static method, fromElement(), which returns a RestrictionTarget instance that can be used to restrict a captured video track to a specified DOM element.

Additions to the MediaDevices interface

MediaDevices.getDisplayMedia()

The getDisplayMedia() method is added to the MediaDevices interface. Similar to getUserMedia(), this method creates a promise that resolves with a MediaStream containing the display area selected by the user, in a format that matches the specified options.

Additions to existing dictionaries

The Screen Capture API adds properties to the following dictionaries defined by other specifications.

MediaTrackConstraints

MediaTrackConstraints.displaySurface

A ConstrainDOMString indicating what type of display surface is to be captured. The value is one of browser, monitor, or window.

MediaTrackConstraints.logicalSurface

Indicates whether or not the video in the stream represents a logical display surface (that is, one which may not be entirely visible onscreen, or may be completely offscreen). A value of true indicates a logical display surface is to be captured.

MediaTrackConstraints.suppressLocalAudioPlayback

Controls whether the audio playing in a tab will continue to be played out of a user's local speakers when the tab is captured, or whether it will be suppressed. A value of true indicates that it will be suppressed.

MediaTrackSettings

MediaTrackSettings.cursor

A string which indicates whether or not the display surface currently being captured includes the mouse cursor, and if so, whether it's only visible while the mouse is in motion or if it's always visible. The value is one of always, motion, or never.

MediaTrackSettings.displaySurface

A string indicating what type of display surface is currently being captured. The value is one of browser, monitor, or window.

MediaTrackSettings.logicalSurface

A boolean value, which is true if the video being captured doesn't directly correspond to a single onscreen display area.

MediaTrackSettings.suppressLocalAudioPlayback

A boolean value, which is true if the audio being captured is not played out of the user's local speakers.

MediaTrackSettings.screenPixelRatio

A number representing the ratio of the physical size of a pixel on the captured display surface (displayed at its physical resolution) to the logical size of a CSS pixel on the capturing screen (displayed at its logical resolution). It cannot be used as a constraint or capability.

MediaTrackSupportedConstraints

MediaTrackSupportedConstraints.displaySurface

A boolean, which is true if the current environment supports the MediaTrackConstraints.displaySurface constraint.

MediaTrackSupportedConstraints.logicalSurface

A boolean, which is true if the current environment supports the constraint MediaTrackConstraints.logicalSurface.

MediaTrackSupportedConstraints.suppressLocalAudioPlayback

A boolean, which is true if the current environment supports the constraint MediaTrackConstraints.suppressLocalAudioPlayback.

Security considerations

Websites that support Permissions Policy (either using the HTTP Permissions-Policy header or the <iframe> attribute allow) can specify a desire to use the Screen Capture API using the directive display-capture:

html
<iframe allow="display-capture" src="/some-other-document.html">…</iframe>

A site can also specify a desire to use the Captured Surface Control API via the captured-surface-control directive. Specifically, the forwardWheel(), increaseZoomLevel(), decreaseZoomLevel(), and resetZoomLevel() methods are controlled by this directive.

The default allowlist for both directives is self, which permits any content within the same origin use Screen Capture.

These methods are considered powerful features, which means that even if permission is allowed via a Permissions-Policy, the user will still be prompted for permission to use them. The Permissions API can be used to query the aggregate permission (from both the website and the user) for using the listed features.

In addition, the specification requires that a user has recently interacted with the page to use these features — this means that transient activation is required. See the individual method pages for more details.

Specifications

Specification
Screen Capture
Element Capture
Region Capture
Captured Surface Control

Browser compatibility

api.MediaDevices.getDisplayMedia

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getDisplayMedia()
Chrome – Full support
Chrome 72 (Release date: 2019-01-29)
footnote Full support
Edge – Partial support
Edge 17 – 18 (Release date: 2018-04-30)
footnote Partial support
footnote Available as a member of Navigator instead of MediaDevices.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox 33 – 65 (Release date: 2014-10-14)
footnote Since Firefox 33 you can capture screen data using getUserMedia(), with a video constraint called mediaSource. Before 52 it relied on a client-configurable list of allowed sites.
Firefox – Full support
Firefox 66 (Release date: 2019-03-19)
footnote Full support
Opera – Full support
Opera 60 (Release date: 2019-04-09)
footnote Full support
Safari – Full support
Safari 13 (Release date: 2019-09-19)
footnote Full support
Chrome Android – No support
Chrome Android
footnote
footnote From Chrome Android 72 to 88, this method was exposed, but always failed with NotAllowedError. See bug 40418135.
Firefox for Android – No support
Firefox for Android
footnote
footnote From Firefox Android 66 to 79, this method was exposed, but always failed with NotAllowedError.
Opera Android – No support
Opera Android
footnote
footnote From Opera Android 51 to 88, this method was exposed, but always failed with NotAllowedError. See bug 40418135.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote
footnote From Samsung Internet 11.0 to 88, this method was exposed, but always failed with NotAllowedError. See bug 40418135.
WebView Android – No support
WebView Android
footnote
footnote From WebView Android 72 to 88, this method was exposed, but always failed with NotAllowedError. See bug 40418135.
WebView on iOS – No support
WebView on iOS
footnote No support
Audio capture support
Chrome – Full support
Chrome 74 (Release date: 2019-04-23)
footnote
footnote On Windows and ChromeOS, the entire system audio can be captured when sharing an entire screen. On Linux and macOS, only the audio of a tab can be captured.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote
footnote On Windows and ChromeOS, the entire system audio can be captured when sharing an entire screen. On Linux and macOS, only the audio of a tab can be captured.
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 62 (Release date: 2019-06-27)
footnote
footnote On Windows and ChromeOS, the entire system audio can be captured when sharing an entire screen. On Linux and macOS, only the audio of a tab can be captured.
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
controller option
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 – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
monitorTypeSurfaces option
Experimental
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote
footnote Default value = include
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote
footnote Default value = include
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote
footnote Default value = include
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
preferCurrentTab option
Experimental Non-standard
Chrome – Full support
Chrome 94 (Release date: 2021-09-21)
footnote
footnote Default value = false
Edge – Full support
Edge 94 (Release date: 2021-09-24)
footnote
footnote Default value = false
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 80 (Release date: 2021-10-05)
footnote
footnote Default value = false
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
selfBrowserSurface option
Experimental
Chrome – No support
Chrome 107 – 110 (Release date: 2022-10-25)
footnote Removed in 111 and later
footnote Default value = include
Chrome – Full support
Chrome 112 (Release date: 2023-04-04)
footnote
footnote Default value = exclude
Edge – No support
Edge 107 – 110 (Release date: 2022-10-27)
footnote Removed in 111 and later
footnote Default value = include
Edge – Full support
Edge 112 (Release date: 2023-04-06)
footnote
footnote Default value = exclude
Firefox – No support
Firefox
footnote No support
Opera – No support
Opera 93 – 96 (Release date: 2022-11-17)
footnote Removed in 97 and later
footnote Default value = include
Opera – Full support
Opera 98 (Release date: 2023-04-20)
footnote
footnote Default value = exclude
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
surfaceSwitching option
Experimental
Chrome – Full support
Chrome 107 (Release date: 2022-10-25)
footnote
footnote Default value = exclude
Edge – Full support
Edge 107 (Release date: 2022-10-27)
footnote
footnote Default value = exclude
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 93 (Release date: 2022-11-17)
footnote
footnote Default value = exclude
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
systemAudio option
Experimental
Chrome – Full support
Chrome 105 (Release date: 2022-09-02)
footnote
footnote Default value = include
Edge – Full support
Edge 105 (Release date: 2022-09-01)
footnote
footnote Default value = include
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 91 (Release date: 2022-09-14)
footnote
footnote Default value = include
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
windowAudio option
Experimental
Chrome – Partial support
Chrome 141 (Release date: 2025-09-30)
footnote Partial support
footnote Defaults to "system".
footnote Only supports values "exclude" and "system", not "window".
Edge – Partial support
Edge 141 – 142 (Release date: 2025-10-03)
footnote Removed in 143 and later
footnote Partial support
footnote Defaults to "system". Before Edge 142, it defaulted to "exclude".
footnote Only supports values "exclude" and "system", not "window".
Firefox – No support
Firefox
footnote No support
Opera – Partial support
Opera 125 (Release date: 2025-12-04)
footnote Partial support
footnote Defaults to "system".
footnote Only supports values "exclude" and "system", not "window".
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No 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
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
See implementation notes.
Has more compatibility info.

api.CropTarget

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CropTarget
Experimental
Chrome – Full support
Chrome 104 (Release date: 2022-08-02)
footnote Full support
Edge – Full support
Edge 104 (Release date: 2022-08-05)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 90 (Release date: 2022-08-18)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
fromElement() static method
Experimental
Chrome – Full support
Chrome 104 (Release date: 2022-08-02)
footnote Full support
Edge – Full support
Edge 104 (Release date: 2022-08-05)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 90 (Release date: 2022-08-18)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No 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.

api.RestrictionTarget

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
RestrictionTarget
Experimental
Chrome – Full support
Chrome 132 (Release date: 2025-01-14)
footnote Full support
Edge – Full support
Edge 132 (Release date: 2025-01-17)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 117 (Release date: 2025-02-13)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
fromElement() static method
Experimental
Chrome – Full support
Chrome 132 (Release date: 2025-01-14)
footnote Full support
Edge – Full support
Edge 132 (Release date: 2025-01-17)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 117 (Release date: 2025-02-13)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No 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