[Webkit-unassigned] [Bug 132691] HTMLAudioElement doesn't play with Javascript on mobile WebKit (Safari and Chrome on iPad/iPhone/Android) 7)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 9 11:13:33 PDT 2014


--- Comment #4 from Jer Noble <jer.noble at apple.com>  2014-05-09 11:13:53 PST ---
(In reply to comment #3)
> (In reply to comment #2)
> > Hugo, you're correct that iOS WebKit requires user interaction to load or play media, but this policy will not change, so I'm closing this bug as WONTFIX.
> > 
> > However, you have some options.
> > 
> > 1) You can try the WebAudio API instead.  It has a similar restriction, but it requires user interaction only once per AudioContext, so playing sounds after an initial click shouldn't be a problem. Media data is loaded over XHR, so pre-loading your media is unrestricted.
> > 
> > 2) You can create all your <audio> elements at once in response to a "click" event and require your users to click the screen to begin your presentation.
> > 
> > But if sites like http://html5gameengine.com/ are trying to use <audio> elements for game sounds, they're going to have a bad time.  <audio> is not intended for low-latency short sounds.  They should move over to the WebAudio API instead.
> Thank you for your feedback. 
> I have followed instructions at https://developer.apple.com/library/safari/documentation/audiovideo/conceptual/using_html5_audio_video/PlayingandSynthesizingSounds/PlayingandSynthesizingSounds.html and http://www.html5rocks.com/en/tutorials/webaudio/intro/ 
> I implemented a function that creates a new AudioContext(), load the audio file asynchronously using XHR (arraybuffer) create a new source, set the buffer and play(0).
> I attached this function to an onClick() event of a TD tag. It still will not play the sound. Although it play fine on Windows. 
> What am I doing wrong ?

Try to call AudioContext.startRendering() from within your click handler.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list