New issue
Advanced search Search tips

Issue 884337 link

Starred by 6 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 30
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

AudioContext resume promise doesn't resolve or reject when audio is locked

Reported by ja...@goldfirestudios.com, Sep 14

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36

Steps to reproduce the problem:
1. Run the provided test case without performing any user interactions on the page (also at https://codepen.io/goldfire/pen/MGBVGE).

What is the expected behavior?
The AudioContext.resume promise should either resolve or reject.

What went wrong?
Nothing happens, the promise just hangs without ever returning. This makes it impossible to know that the audio is locked.

Did this work before? N/A 

Chrome version: 69.0.3497.92  Channel: stable
OS Version: OS X 10.13.6
Flash Version: 

This was claimed to be fixed in #842921, but as you can see it is still not working. It now just throws "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page." as a warning with no way to detect this in the code.
 
I forgot to attach the test case, so here it is.
web_audio_test.js
198 bytes View Download
Labels: Needs-Triage-M69
Components: -Blink Blink>WebAudio
Labels: Needs-Feedback
james@

I always get "success" from the repro case. Can you elaborate the problem where "the audio is locked"? What's your expectation here?

M69 does not enforce the autoplay policy against AudioContext. So seeing "success" seems to be WAI.
Sorry, I meant to mark this as Chrome 70. I'm working on an update to howler.js to handle the impending change in Chrome 70 and this issue is making that essentially impossible. If you test it on Canary you don't get any respond from the resume call.
Project Member

Comment 6 by sheriffbot@chromium.org, Sep 17

Cc: hongchan@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I just tried again with Canary 71.0.3554.0 (MacOS), and I still see "success".
Although it does not hang, this might be a bug. Or the actual enforcement of autoplay policy still might not be in effect.

rtoy@ WDYT?
What if you force it through flags as suggested in the docs?

./Google\ Chrome\ Canary --disable-features=PreloadMediaEngagementData,AutoplayIgnoreWebAudio,MediaEngagementBypassAutoplayPolicies
Status: Untriaged (was: Unconfirmed)
II just get warnings that the context was not allowed to start. I think it would be natural for resume to reject the promise, but the spec doesn't seem to say that. If it's not allowed to start, the promise is placed on the pending resume list. I didn't see anything that said what these pending resume promises get resolved (or rejected).

See https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume.  The section in running a control message (next paragraph) talks about rejecting these promises, but since the steps were aborted, queuing a control message doesn't happen.

Perhaps a bug in the spec?
Right, there is only a warning in the console, which as far as I can tell means there is no way to programmatically determine that the audio is currently locked. Chrome is about to flip the switch again on this breaking change without providing any sufficient means of handling it.

I'm the author of howler.js, and I've been trying to get this working in the library so that thousand of sites won't break due to this change. The Chrome docs only suggestion is to "simply" call resume from within a click handler, but there is no way to enforce or detect this in a general purpose library.

The expectation was that a promise would function as a promise is intended to function. You would think after the debacle that was the initial auto play release that Google would have put a little more thought into how this gets handled.

Hopefully I'm missing something, but so far neither I or any of our contributors have found a way to handle this in a general use case.
It seems sensible for it to reject the promise, but there might be a reason why we don't.  I'll file an issue on the spec to get this clarified.
Status: Available (was: Untriaged)
Status: WontFix (was: Available)
The linked spec issue is now resolved: when the audio is blocked by autoplay policy, the promise from AudioContext.resume() will neither resolve or reject. Hence, WontFix.

Details can be found in the spec issue above.

Sign in to add a comment