Contact emails
mlam...@chromium.org (eng), renga...@chromium.org (pm)
Spec
No spec.
Public discussion at https://github.com/WebAudio/web-audio-api/issues/836.
Summary of WebKit iOS behaviour at https://docs.google.com/document/d/16EzKmZJNNyvKC1UN-heRN2h32ZF6H1EUCbcrcxRH7H4/edit
Both spec editors are interested to either specify WebKit’s behaviour or at least something similar.
Summary
Chrome Android will require a user gesture in order to start playback using Web Audio, the same way a user gesture is required to play an audio or video element.
Motivation
A more consistent experience for playback without a user gesture in Chrome Android and mobile Safari. The proposal is to require a user gesture for Web Audio - just like mobile Safari and HTMLMediaElement and brings consistency to the mobile web platform.
Interoperability and Compatibility Risk
Firefox: Public support
Edge: No public signals
Safari: Shipped
Web developers: No signals
If we ship exactly what WebKit does or something compatible with it, interoperability will increase. However, websites doing UA sniffing might break on Chrome. We landed UMA to measure this.
If we ship something too different from Safari, interoperability might be affected unless Safari follows. However, given that the benefit of shipping something very different is low, chances are we will not unless the editors insist on it.
We will start by implementing something compatible with Safari’s implementation.
Ongoing technical constraints
None.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
As far as Chrome is concerned, this will only ship on Android. However, the feature itself doesn’t have platform specific constraints.
OWP launch tracking bug
Link to entry on the feature dashboard
https://www.chromestatus.com/features/6406908126691328
Requesting approval to ship?
No.
Contact emails
mlam...@chromium.org (eng), renga...@chromium.org (pm)
Spec
No spec.
Public discussion at https://github.com/WebAudio/web-audio-api/issues/836.
Summary of WebKit iOS behaviour at https://docs.google.com/document/d/16EzKmZJNNyvKC1UN-heRN2h32ZF6H1EUCbcrcxRH7H4/edit
Both spec editors are interested to either specify WebKit’s behaviour or at least something similar.
Summary
Chrome Android will require a user gesture in order to start playback using Web Audio, the same way a user gesture is required to play an audio or video element.
Motivation
A more consistent experience for playback without a user gesture in Chrome Android and mobile Safari. The proposal is to require a user gesture for Web Audio - just like mobile Safari and HTMLMediaElement and brings consistency to the mobile web platform.
Interoperability and Compatibility Risk
Firefox: Public support
I got opposition to having the spec require user gestures for requesting permission from a Firefox developer in https://github.com/w3c/permissions/issues/77. He was fine with allowing UAs to do this. Ben Wells was sympathetic to using 'may' instead of 'must' for this too. Folks may have different opinions about requesting permission vs playing audio, of course.
Jan-Ivar, interaction with gUM-originating MediaStreams is a good question. MediaStreams are special-cased in HTMLMediaElement in Blink as not requiring any user gesture to play, but that's not entirely without issues.
On 6/8/16 11:38 AM, Philip Jägenstedt wrote:
Jan-Ivar, interaction with gUM-originating MediaStreams is a good question. MediaStreams are special-cased in HTMLMediaElement in Blink as not requiring any user gesture to play, but that's not entirely without issues.Yeah, the one that comes to mind being Chrome deciding to implement https://github.com/w3c/mediacapture-fromelement
Correct. Chrome Android intents to intervene and block Web Audio
autoplay for consistency with its autoplay behaviour. As a product it
doesn't make sense to block autoplay for <audio> but not Web Audio while
you can simply play any audio file via Web Audio. See:
https://mounirlamouri.github.io/sandbox/autoplay/webaudio.html
I want to make sure that we don't do crazy hacks and that means working
directly with the specification to make sure this is handled as best as
possible. The bare minimum would be to specify WebKit's behaviour. Note
that this is not an intent to ship and we don't know yet for sure what
will ship.
> Additionally, AudioContexts never switching to running state will cause
> unfortunate timing side effects (we used to have an issue with Chrome not
> starting the clock immediately - this would likely cause a side effect
> like
> this.) The normal process is that AudioContexts automatically switch to
> running state when created; this would break that expectation. The
> messiness with ScriptProcessor (captured in your doc) also adds another
> layer of complexity - as would AudioParams being constructible (you could
> use an AudioParam to create sound) (issue
> <https://github.com/WebAudio/web-audio-api/issues/367>).
>
> In short - I think Webkit made a poor decision when they chose to
> implement
> this, and I would hate to see that pattern get propagated to other
> browsers.
I agree that WebKit's implementation is hacky in some ways but I assume
that they had to implement their behaviour without too many side effects
on the rest of the API behaviour. My hope, and this is why I started
this discussion on the spec is that we can come up with a good solution
that acknowledge this use case.
In other words, if the Web Audio specification doesn't accept that some
UA will not allow playback unless the user interacted with the page, UA
will find ways to enforce this restriction and developers will have to
write browser specific code. Embracing this is probably the best
solution for UA, web developers and users.
> >>
> >
> > Do you have a link to this support?
padenot (see github issue I linked) is the main Mozilla person working
on Web Audio. As you can see he is in favour of the spec change (CC'd
him).
I'm not at all surprised that this is a controversial change. I think what we should hope for, in the end, is a consistent behavior for both <audio> and Web Audio and that all browsers on all platforms have the same behavior, even if the spec allows for variation.
That's a very high bar, but at the very least it's weird for a single browser on a single platform to allow automatic audio playback in one context and not another if the user can't tell the difference. (There is another obvious way of unifying behavior, but let's stick to what is actually being proposed right now.)
Chris, Hongchan, even though you think this is a terrible idea as the default behavior, is there any context where you think disallowing automatic Web Audio playback would make sense (sandboxed iframes?) and what would be a good shape of the API for those situations?
Jan-Ivar, interaction with gUM-originating MediaStreams is a good question. MediaStreams are special-cased in HTMLMediaElement in Blink as not requiring any user gesture to play, but that's not entirely without issues. It could be that some tab-level tracking of "user allows playback" is actually needed to make sense of all of this.
For what it's worth, I have heard reports that one of the largest group of advertisers is pushing for requiring unumuted state in order to record an ad has viewed (on top of the existing viewability requirements). As one can imagine, these unmuted ads tend to be more profitable (by necessity).
With these bad incentives, the risk that a non negligible amount of websites (say with unique content or appeal) will decide to downplay user retention concerns is palpable.
Afterall, while slightly less annoying, there is no shortage of examples where user retention was belittled: pop-over, interstitials, obnoxious app banners, heavy JS workaround for autoplay, etc...
I hope we can find a solution that doesn't end up like disabling autoplay.