demo · v141
Exclude on Window
A video-call app that shares the user's window — Slack, Zoom — wants no system-wide audio bleed when the user picks a single window to share. The new windowAudio: "exclude" hint tells the platform: if the user shares a window (not the full screen), drop the system audio capture entirely. Clean shares, no surprise leaks.
systemAudio is set. getSettings() confirms what the platform delivered.
Pick a windowAudio policy and start the capture. Then choose a window in the OS picker to see how the policy applies:
the call
const stream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: true,
systemAudio: "include",
windowAudio: "exclude", // ← new in 141 — only matters if user picks a window
});
// Read-back: did the user pick a window, and did the policy fire?
const track = stream.getAudioTracks()[0];
if (!track) console.log("no audio track — windowAudio:exclude probably fired");
else console.log("audio track present with settings:", track.getSettings());
why this angle
The explainer focuses on this exact scenario: an app configured for audio capture wants to drop audio when the user limits the share to a window. The asymmetry matters — sharing your whole screen is usually deliberate (you want everyone to hear the YouTube clip too); sharing one window usually isn't (you wanted to show your code editor, you didn't want to broadcast the music app behind it). The hint lets app authors codify "be conservative on window picks" without losing system-audio capture when the user shares a full display.