Enable the pref `media.autoplay.block-webaudio`
Categories
(Core :: Audio/Video: Playback, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: alwu, Assigned: alwu)
References
Details
Attachments
(1 file)
The reason we didn't enable this pref is because based on our old telemetry data (WEB_AUDIO_AUTOPLAY) still showed that there were a half of cases where the web audio would never be unblocked. We thought that might be a sign of breaking websites.
Chrome enabled blocking web audio on 71 and Safari also block web audio, so maybe we should not treat those never-unblocked cases as a sign of breaking sites, they might be other use cases which doesn't affect the user experience.
In addition, we also enable this old feature on Nightly for a long while and didn't see any related bug report. So it might be a time to enable this feature now.
Assignee | ||
Comment 1•3 years ago
|
||
Comment 3•3 years ago
|
||
bugherder |
Comment 4•2 years ago
|
||
Hi Alastor!
Docs for this changed in https://github.com/mdn/content/issues/24311. Note, that the docs say this:
media.autoplay.block-webaudio
A Boolean preference which indicates whether to apply autoplay blocking to the Web Audio API.
My understanding is that this means that by default the if you use the web audio API (audiocontext) the content won't autoplay. That means first time you come to a site the content won't autoplay. So what are the conditions to make it autoplay?
- transient user interaction?
- sticky user interaction?
- Can you enable with permission policy?
- Something else?
Assignee | ||
Comment 5•2 years ago
|
||
Web audio spec requires the sticky user activation, so there is no way to start a AudioContext
before the page gets activated by the sticky user activation. Only exception is for Offline Audio Context, which is not regarded as a target for blocking autoplay because it won't output any sound to audio devices.
After the sticky activation has been performed on the page, there are ways to start AudioContext
(1) calling AudioContext.resume()
(2) calling AudioScheduledSourceNode.start()
which has been attached to the targeted AudioContext
(3) connect a MediaStreamAudioSourceNode
to targeted AudioContext
and start that node
There are some examples you can refer.
Comment 6•2 years ago
|
||
Thanks Alastor - I read it as "may" not "must" have sticky user activation:
"A user agent may disallow this initial transition, and to allow it only when the AudioContext's relevant global object has sticky activation."
In any case, I think what you're saying is that this preference is what FF uses to enforce sticky activation. If you were to set this false then autoplay might be allowed?
Assignee | ||
Comment 7•2 years ago
|
||
Sorry for my late reply. Yes, if the pref is false, then web audio won't be blocked and always be allowed to autoplay.
Description
•