Search code examples
google-chromeaudiogoogle-chrome-appgoogle-chrome-os

Chrome audio API is undefined (Chrome OS app)


In our Chrome App for Chrome OS (yes, we know that Chrome Apps are being discontinued, but this is a kiosk app and kiosk mode is not yet supported for PWAs), we would like to use the chrome.audio API to display system audio volume and mute status. We have audio added to the permissions in our manifest.json, but chrome.audio is returning undefined. Is there something else we need to do to enable the chrome.audio API?


Solution

  • The chrome.audio API only works in a background script and only in kiosk mode, not in a content script or in a user/guest session. Moving the call to the background script and running in kiosk mode fixes the issue. It would be nice if Google would bother to document these things...

    H/T @wOxxOm