Skip to content

Commit

Permalink
Implement the DisplayMediaStreamOptions monitorTypeSurfaces
Browse files Browse the repository at this point in the history
This adds the ability for web applications to provide a hint, indicating
to the user agent whether the application, upon calling getDisplayMedia,
wishes the user has the option to choose the display surfaces whose type
is monitor (screen).

Spec PR: w3c/mediacapture-screen-share#274
Spec: https://w3c.github.io/mediacapture-screen-share/#dom-displaymediastreamoptions-monitortypesurfaces
Intent to ship: TODO
Demo: https://screen-sharing-controls.glitch.me/?monitorTypeSurfaces=exclude
Bug: 1477706
Change-Id: I25ffabe546ddc778f660834e44a9dab15494e92a
  • Loading branch information
beaufortfrancois authored and chromium-wpt-export-bot committed Sep 1, 2023
1 parent c01dec4 commit d216a6c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions screen-capture/getdisplaymedia.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,25 @@
}, `getDisplayMedia({"video":{"displaySurface":"${displaySurface}"}}) with getSettings`);
})
}
promise_test(async (t) => {
const stream = await getDisplayMedia({
video: { displaySurface: "monitor" },
monitorTypeSurfaces: "include",
});
t.add_cleanup(() => stopTracks(stream));
const { displaySurface } = stream.getTracks()[0].getSettings();
assert_equals(displaySurface, "monitor");
}, `getDisplayMedia({"video":{"displaySurface":"monitor"},"monitorTypeSurfaces":"include"}) resolves with a monitor track`);

promise_test(async (t) => {
const stream = await getDisplayMedia({
video: { displaySurface: "monitor" },
monitorTypeSurfaces: "exclude",
});
t.add_cleanup(() => stopTracks(stream));
const { displaySurface } = stream.getTracks()[0].getSettings();
assert_any(assert_equals, displaySurface, ["window", "browser"]);
}, `getDisplayMedia({"video":{"displaySurface":"monitor"},"monitorTypeSurfaces":"exclude"}) resolves with a non monitor track`);

{
const properties = ["displaySurface"];
Expand Down

0 comments on commit d216a6c

Please sign in to comment.