Extension Audio API: Devices, Stream Mute, and Level Control
How Chrome extension APIs list audio devices, filter by stream type, set gain or volume, and mute whole stream classes.
This page summarizes Chrome extension platform documentation for controlling system audio from an extension. The modern surface is the browser.audio namespace (Manifest V3–style promises); the legacy chrome.audio namespace keeps the same device model but still supports optional callbacks on older call patterns. Both APIs expose enumeration with filters, per-device levels, and stream-wide mute.
browser.audio and chrome.audio: when each namespace applies
Section titled “browser.audio and chrome.audio: when each namespace applies”browser.audio methods such as getMute() and setMute() return promises and are documented as available from Chrome 116+, with the broader browser.* family noted from Chrome 148 onward on the browser.audio reference.
The chrome.audio reference documents the same mute behavior with an optional callback on each call. That page states that promises are supported for Manifest V3 and later, and that other platforms need callbacks:
Promises are only supported for Manifest V3 and later, other platforms need to use callbacks.
— Google, chrome.audio
In practice, new extension work should target browser.audio and promise-based calls; maintain legacy MV2 code against chrome.audio only until migration is complete.
Audio devices: identifiers, stream types, and levels
Section titled “Audio devices: identifiers, stream types, and levels”Each listed audio endpoint is described with fields such as deviceName, deviceType, displayName, id, isActive, level, optional stableDeviceId, and streamType. The level field is the live sound level: volume for output devices and gain for input devices. isActive marks whether the device is the current active device for its role.
When you change levels through the API, level in DeviceProperties is optional and defaults to the device’s current level. For input, it represents gain; for output, volume:
If used with audio input device, represents audio device gain.
If used with audio output device, represents audio device volume.
— Google, browser.audio
Level changes can be observed through events that carry deviceId and the new level value on the browser.audio reference.
DeviceFilter: how to narrow the device list
Section titled “DeviceFilter: how to narrow the device list”Listing calls accept an optional filter of type DeviceFilter. If the filter is omitted or set to {}, the returned list includes all available audio devices:
Device properties by which to filter the list of returned audio devices. If the filter is not set or set to , returned device list will contain all available audio devices.
— Google, browser.audio
DeviceFilter supports:
| Field | Type | Effect |
|---|---|---|
isActive |
boolean optional |
Only devices whose active state matches |
streamTypes |
StreamType[] optional |
Only devices whose streamType is in the list |
The same “filter or empty object means all permitted devices” pattern appears on other hardware APIs in this family—for example browser.documentScan (scanner DeviceFilter), chrome.hid (DeviceFilter[] on device permission lists), and chrome.usb (DeviceFilter[] for user selection). USB printer apps declare required manifest filters with vendorId and optional productId or interfaceClass. Audio filtering is stream- and activity-based rather than USB vendor IDs, but the idea—declare constraints before enumerating—is the same.
Stream mute: getMute() and setMute() by StreamType
Section titled “Stream mute: getMute() and setMute() by StreamType”Mute is managed per stream type, not per physical device. getMute(streamType) resolves to a boolean for system-wide mute on that stream. setMute(streamType, isMuted) applies the new mute value to all audio devices that share that streamType:
Sets mute state for a stream type. The mute state will apply to all audio devices with the specified audio stream type.
— Google, browser.audio
getMute() is documented the same way:
Gets the system-wide mute state for the specified stream type.
— Google, browser.audio
When mute changes, event payloads include isMuted and streamType, and the updated mute applies to every device with that stream type—matching the semantics of setMute().
Related audio surfaces in extensions (not full device graphs)
Section titled “Related audio surfaces in extensions (not full device graphs)”Other Chrome extension APIs touch audio but solve different problems. They are not substitutes for browser.audio device lists or stream mute:
- browser.tabCapture and chrome.tabCapture expose optional
audio,video, and constraint objects for capturing tab media streams—not system output device volume. - browser.ttsEngine / chrome.ttsEngine expect synthesized audio buffers with
bufferSizeandsampleRate; that is playback format for TTS, not OS mixer control. - chrome.webviewTag accepts a
muteboolean parameter for embedded webview audio, separate from system stream mute.
Use browser.audio when the extension must reflect or change OS-reported devices, levels, or stream-wide mute states.
Enterprise and session metadata (separate from mixer control)
Section titled “Enterprise and session metadata (separate from mixer control)”Managed deployments sometimes pair hardware policy with extensions, but those namespaces do not replace audio APIs:
- browser.enterprise.hardwarePlatform / chrome.enterprise.hardwarePlatform expose
manufacturerandmodel. - browser.enterprise.networkingAttributes / chrome.enterprise.networkingAttributes expose local
ipv4,ipv6, andmacAddress. - browser.sessions / chrome.sessions list
deviceNameand remotesessionson other signed-in devices.
None of these enumerate audio endpoints or stream mute; keep audio logic on browser.audio.
Common mistakes
Section titled “Common mistakes”- Muting by device
idwhen the product needs stream mute —setMute()only acceptsStreamType; per-device silence usually means settinglevelor using capture APIs. - Ignoring
streamTypesinDeviceFilter— Listing all devices and filtering in JavaScript misses hardware that never appears for the wrong stream class. - Callbacks on MV3 — Prefer promises on
browser.audio; reservechrome.audiocallbacks for legacy paths described on chrome.audio. - Confusing tab capture mute with system mute — Tab capture constraints do not call
setMute()and do not readgetMute(). - Treating
levelas always volume — On input devices it is gain; misleading UI labels confuse users adjusting microphones.
How to check this on your site
Section titled “How to check this on your site”-
Confirm manifest permissions and minimum Chrome version against the browser.audio and, if applicable, chrome.audio references.
-
Load the unpacked extension, call enumeration with
filter: {}, and verify listeddisplayName,streamType, andisActivematch the OS sound settings. -
Call
getMute()for eachStreamTypeyou use, toggle withsetMute(), and confirm all devices sharing that stream type follow the system mute state. -
Adjust
levelon one input and one output device and confirmonLevelChanged(or your UI refresh) reports the newdeviceIdandlevel. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match the official references or behaves differently in your extension, write to yimasynthetic@gmail.com with the page URL and the exact sentence or API behavior you are questioning.