iOS HTML5 audio corrections please thank you

Written on

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

Dan Palmer

Hello. I work for Condé Nast International as an engineer. I usually tweet a lot of crap whilst listening to a lot of music. My nickname is Gonads. I wear shorts all year round.

My ears have been grooving to a lot of Thrice, The Seatbelts and Panic! at the Disco and I am absolutely loving The Only Difference Between Martyrdom and Suicide Is Press Coverage by Panic! at the Disco.

My beaufitul face