Skip to content
AnswerWell geo Documentation

Research · 5 min read · Answerwell

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().

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 bufferSize and sampleRate; that is playback format for TTS, not OS mixer control.
  • chrome.webviewTag accepts a mute boolean 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:

None of these enumerate audio endpoints or stream mute; keep audio logic on browser.audio.

  1. Muting by device id when the product needs stream mute — setMute() only accepts StreamType; per-device silence usually means setting level or using capture APIs.
  2. Ignoring streamTypes in DeviceFilter — Listing all devices and filtering in JavaScript misses hardware that never appears for the wrong stream class.
  3. Callbacks on MV3 — Prefer promises on browser.audio; reserve chrome.audio callbacks for legacy paths described on chrome.audio.
  4. Confusing tab capture mute with system mute — Tab capture constraints do not call setMute() and do not read getMute().
  5. Treating level as always volume — On input devices it is gain; misleading UI labels confuse users adjusting microphones.
  1. Confirm manifest permissions and minimum Chrome version against the browser.audio and, if applicable, chrome.audio references.

  2. Load the unpacked extension, call enumeration with filter: {}, and verify listed displayName, streamType, and isActive match the OS sound settings.

  3. Call getMute() for each StreamType you use, toggle with setMute(), and confirm all devices sharing that stream type follow the system mute state.

  4. Adjust level on one input and one output device and confirm onLevelChanged (or your UI refresh) reports the new deviceId and level.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

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.