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.
When AudioContext.resume() is called for an AudioContext in the "closed" state, the returned promise is rejected. With this proposal, the same behavior will also happen when AudioContext.resume() is called while the AudioContext "interrupted". In this case, a web page that is not aware of the existence of the "interrupted" state might imply that the AudioContext has been closed. In this situation, application shouldn't rely solely on the returned promise resolution outcome and also check the AudioContext state.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
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
Shipping on desktop | 136 |
Shipping on Android | 136 |
Shipping on WebView | 136 |
Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).
This feature has been added to the Web Audio spec: https://webaudio.github.io/web-audio-api/#dom-audiocontextstate-interrupted--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/67e318b0.170a0220.e1a1e.0863.GAE%40google.com.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw-LK%3DSkLwrqz%2BU2d6X0WFX0-eusrMr-WwtD9O4QjLedMw%40mail.gmail.com.
LGTM3 - it's nice to see cross-vendor support for this.