WPT details: This feature cannot be tested by itself because it cannot be used directly by web applications. An AudioContext should only transition to the "interrupted" state at the user agent's discretion - i.e. there is no public web API to interrupt the AudioContext. However, other Web APIs' specifications will depend on the "interrupted" state and can have web tests that expect the AudioContext to be interrupted in some situations: For example: - https://www.w3.org/TR/audio-session/ - https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/IframeMediaPause/iframe_media_pausing.md
The current Web Audio API lacks a mechanism for the User Agent (UA) to interrupt playback for scenarios such as exclusive audio access (VoIP) or when a laptop lid is closed. To address this, we propose adding an "interrupted" state to AudioContextState. This new state would allow the UA to pause playback in these scenarios and enable web applications to respond appropriately.
Currently, there is no way for the User Agent (UA) to interrupt a Web Audio API AudioContext playback on its own - i.e., the suspension must happen in response to a user action. There are scenarios where the UA must be able to interrupt audio playback on its own: - Interrupt an AudioContext when another application requires exclusive access to audio hardware; - Audio Session API (https://w3c.github.io/audio-session/) - "media-playback-while-not-visible" permission policy (https://chromestatus.com/feature/5082950457884672)
Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/AudioContextInterruptedState/explainer.md