let mayHaveBackdropFlag = false;
let displaySurface = displayStream
.getVideoTracks()[0]
.getSettings().displaySurface;
if (displaySurface === "monitor") {
mayHaveBackdropFlag = true;
}MediaTrackConstraints: displaySurface property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
dsConstraints = { displaySurface: "window" }; // 'browser' and 'monitor' are also possible
applyConstraints(dsConstraints);
// The user still may choose to share the monitor or the browser,
// but we indicated that a window is preferred.