
The music keeps playing…until the current song ends.

Then, the user leaves her phone alone perhaps she’s in the car driving while listening to the music.Īfter a short period of time, the phone screen turns off. The most common scenario for my app: user goes to my web app, the app starts playing music. Audio can’t play the next track when the phone screen is off. So, we callĪudio.addEventListener(“ended”, playNextSong)īut the playNextSong function never fires JavaScript has been suspended, and users are disappointed. Music playing apps need to know when the song is finished in order to play the next song. This sounds good in theory: you’re not using a web site, so Safari will just stop executing any JavaScript since you’re not using it anyways.īut in practice, this kills real web apps on iOS. Why? Because Apple suspends all JavaScript execution in the name of performance. Upon investigation, HTMLAudioElement ended event is never fired. When the current song ends, the music just stops. Why hurt real web apps and real users by singling out audio apps? Audio can’t play next track in backgroundĬommon user scenario: they go to my web app, hit play, and the music starts streaming in. So we have to have special handling for iOS to require the user to interact with the UI before playing.Īs for battery life, 3d content, muted, gifs, ads and more don’t require interaction before start. None of the other operating systems, mobile or desktop, do this. But it’s an artificial restriction by Apple, likely for user experience and battery life reasons. This is the most minor of the busted things. (JavaScript execution is suspended when the phone screen is off no way to set audio.src for the next song)ĭetails on each of these below: Audio doesn’t play until user interaction


I was hoping that the new (July 2016) relaxed web media restrictions in iOS 10+ would un-cripple HTML5 audio in iOS. And what I found is that iOS still cripples web apps that use HTML5 audio. Apple’s mobile implementation of HTML5 audio is still busted.Īfter releasing the new version last week, my users reported things still busted on iOS devices: It’s an HTML5 music player in the vein of Pandora (users can thumb up songs, influencing what gets played) for the Messianic Jewish faith.Īnd thanks to the magic of the web and HTML5 audio, it works flawlessly on PCs, Macs, and Linux.
#Html5 audio ipad update
Last week I published a big update to Chavah Messianic Jewish radio. Update June 2017: I’ve filed a bug with the iOS WebKit team to address the major blocking issue. It is currently impossible to build a music player web app that works on iOS. Now as we enter 2017, it turns out things are still horribly broken.

Summary: Back in 2012, I wrote that HTML5 audio is broken on iOS.
