Skip to main content

iOS HTML5 audio corrections please thank you

Written on under Dev

After my last post, I had run into a few issues with iOS and HTML5 audio. So for a little bit tonight, I've been playing around with it to see what can be done to preload and play audio automatically on the devices. The two versions of iOS I played with were 5 and 6 as these are all I can get my hands on.

The reason I looked backed into this is because after I thought I had cracked it and managed to get audio preloading, it failed to work on a colleague's iPad. I was under the assumption that it was something to do with my setTimeout loop, trying to force it to play and then pause but it was due to the fact the iOS version was 5.

Here is a table to what I tested and played with earlier and to whether it played or not (plus I had forgot I styled up my table's header with the red colour which I rather like so it gives me another reason to show it):

DeviceiOS versionForce load & playTap load & play
iPad (real)6.0YesYes
iPhone (real)6.0NoYes
iPad (simulator)6.0NoYes
iPhone (simulator)6.0NoYes
iPad (simulator)5.0NoYes
iPhone (simulator)5.0NoYes

So for pretty much everything, you need to have the user's input to initialise any sort of load or play. However I am curious as to why my iPad preloads and plays straight away without any input.

I also did a little test to see what events are fired when loading the audio. This is more for reference:

  1. loadstart

  2. progress

  3. suspend