demo · v141
Include Window Audio
Decision matrix for the three windowAudio values across the three things a user can pick (full monitor, single window, browser tab). Use case: a video-call app that wants to capture the window's audio for a demo (Loom, Tella) — windowAudio: "window" is the right default.
Headings: user's picker choice. Rows: app's windowAudio value. Cells: what audio you get:
user picks: window
user picks: tab
system audio (from systemAudio)
that window's audio only
that tab's audio only
system audio (the hint doesn't apply)
no audio (silently dropped)
no audio
system audio
system audio (not just the window)
system audio
the call
// app demo / tutorial recorder — want the window's own audio
const stream = await navigator.mediaDevices.getDisplayMedia({
video: { displaySurface: "window" },
audio: true,
windowAudio: "window",
});
const settings = stream.getAudioTracks()[0]?.getSettings();
// settings.windowAudio === "window" if the platform honoured the hint
why this angle
The first concept covered the conservative use case (exclude). This one covers the opposite — apps that intentionally want the chosen window's audio. The interaction with the user's picker choice is non-obvious, which is why the matrix above matters: the same hint produces different outcomes depending on what the user selects, and the only honest way to know is getSettings().