Re: iOS 6 context "activation" requirement

On Nov 5, 2012, at 6:45 AM, Joseph Berkovitz <joe@noteflight.com> wrote:

> Speaking of "currentTime" not increasing… In iOS6 WebKit: not only does a node need to be added to the context for the time to advance, but this addition must initially take place in a thread triggered by some user-initiated event. Otherwise the time doesn't advance and no audio output occurs. I assume this is due to iOS6's attempt to prevent audio "spamming" by web pages.  It probably relates to Jer Noble's question of 2/28/2012:
> 
>> 	• Should an AudioContext be allowed to play without being initiated with a user gesture?
>> 
> 
> 
> What is the status of the current iOS 6 behavior -- is it a proposed addition to the spec? A bug? An undocumented vendor modification?

The latter.  In this respect, it's similar to the user-interaction restriction on media element loading and playback on iOS.

> I'm not presently arguing for a specific policy. However, the present approach on iOS does require a tricky workaround when audio output is both user-initiated *and* asynchronous (e.g. user interacts with game, 1 second later a sound effect occurs). In our application we have had to immediately play a silent sound in the context on the first user interaction, in order to permit later asynchronous sounds to be played.
> 
> Both the behavior and the workaround aren't all that obvious and I burned a bunch of time trying to figure out why the API sometimes worked and sometimes didn't. If that's going to be the recommended practice, I'd love to get the issue resolved and any consequent changes published in the spec.  (Admission: I haven't looked through Apple's iOS 6 docs to see if this behavior was documented there.)

Unfortunately, this isn't mentioned in the Safari Web Audio documentation <http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/PlayingandSynthesizingSounds/PlayingandSynthesizingSounds.html#//apple_ref/doc/uid/TP40009523-CH6-SW1>.  The best person to talk to about documentation issues like this is Vicki Murley <vicki@apple.com>, the Safari Technologies Evangelist.  I'll give her a heads-up.

-Jer

Received on Monday, 5 November 2012 17:22:07 UTC