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.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The CaptureController interface 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.
CaptureController() Experimental
Creates a new CaptureController object instance.
zoomLevel Experimental
The captured display surface's current zoom level.
decreaseZoomLevel() Experimental
Decreases the captured display surface's zoom level by one increment.
forwardWheel() Experimental
Starts forwarding wheel events fired on the referenced element to the viewport of an associated captured display surface.
getSupportedZoomLevels() Experimental
Returns the different zoom levels supported by the captured display surface.
increaseZoomLevel() Experimental
Increases the captured display surface's zoom level by one increment.
resetZoomLevel() Experimental
Resets the captured display surface's zoom to its initial level, which is 100.
setFocusBehavior() Experimental
Controls whether the captured tab or window will be focused or whether the focus will remain with the tab containing the capturing app.
zoomlevelchange Experimental
Fires when the captured display surface's zoom level changes.
// Create a new CaptureController instance
const controller = new CaptureController();
// Prompt the user to share a tab, window, or screen.
const stream = await navigator.mediaDevices.getDisplayMedia({ controller });
// Query the displaySurface value of the captured video track
const [track] = stream.getVideoTracks();
const displaySurface = track.getSettings().displaySurface;
if (displaySurface === "browser") {
// Focus the captured tab.
controller.setFocusBehavior("focus-captured-surface");
} else if (displaySurface === "window") {
// Do not move focus to the captured window.
// Keep the capturing page focused.
controller.setFocusBehavior("no-focus-change");
}
| Specification |
|---|
| Screen Capture> # dom-capturecontroller> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
CaptureController |
109 | 109 | No | 95 | No | No | No | No | No | No | No | No |
CaptureController |
109 | 109 | No | 95 | No | No | No | No | No | No | No | No |
decreaseZoomLevel |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
forwardWheel |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
getSupportedZoomLevels |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
increaseZoomLevel |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
resetZoomLevel |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
setFocusBehavior |
109 | 109 | No | 95 | No | No | No | No | No | No | No | No |
zoomLevel |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
zoomlevelchange_event |
136 | 136 | No | 121 | No | No | No | No | No | No | No | No |
MediaDevices.getDisplayMedia()
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CaptureController