The CaptureController
interface provides methods that can be used to further manipulate a capture session separate from its initiation via MediaDevices.getDisplayMedia()
.
A CaptureController
object is associated with a capture session by passing it into a getDisplayMedia()
call as the value of the options object's controller
property.
Constructor
CaptureController()
Experimental
-
Creates a new CaptureController
object instance.
Instance methods
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.
Examples
const controller = new CaptureController();
const stream = await navigator.mediaDevices.getDisplayMedia({ controller });
const [track] = stream.getVideoTracks();
const displaySurface = track.getSettings().displaySurface;
if (displaySurface == "browser") {
controller.setFocusBehavior("focus-captured-surface");
} else if (displaySurface == "window") {
controller.setFocusBehavior("no-focus-change");
}
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
CaptureController |
109 |
109 |
No |
No |
95 |
No |
No |
No |
No |
No |
No |
No |
CaptureController |
109 |
109 |
No |
No |
95 |
No |
No |
No |
No |
No |
No |
No |
setFocusBehavior |
109 |
109 |
No |
No |
95 |
No |
No |
No |
No |
No |
No |
No |
See also