demo · v131
getAllScreensMedia()
One call captures every connected display. Limited to Isolated Web Apps with the all-screens-capture permission policy — but you can probe support and attempt the call from any page; this demo will show you what happens.
scope
Outside an Isolated Web App, the promise rejects with a
NotAllowedError. The button below still calls the API so you can see the exact error in the log.
probing…
No active streams yet.
the api
// Returns one MediaStream per attached screen, in a single call.
const streams = await navigator.mediaDevices.getAllScreensMedia();
for (const stream of streams) {
const [track] = stream.getVideoTracks();
const settings = track.getSettings();
track.onended = () => showDisconnected(settings.deviceId);
videoEl.srcObject = new MediaStream([track]);
}