HTML5 Audio causing standalone mode to crash and exit to home screen in IOS8

908 views Asked by At

I have a site that every time the javascript executes document.getElementById('audioID').load(); or document.getElementById('audioID').play(); it will cause my iPad/ iPod running iOS8 in standalone mode to suddenly crash and exit to the home screen. The same site running the normal Safari browser on iOS8 works perfectly fine. I could not reproduce this issue on iOS7 either.

This issue seems similar to the following stack issue that appears to be describing an IOS8 bug: Why HTML5 video doesn't play in IOS 8 WebApp(webview)? , except that my issue deals with audio instead of video and is not just failing to play the audio but it is crashing the standalone window.

Has anyone else experienced this, or know what exactly could be causing the standalone mode to crash after?

[UPDATE]

It appears to be the combination of a submit button along with attempting to play audio in iOS8's standalone mode will cause a crash. I have created a quick gist that demos this bug here: https://gist.github.com/macmadill/262d65ad1c02936fca4b

[UPDATE]

I retested this bug on 3 different iPads, here are my results:

iOS 8.1.2 - standalone mode crashed

iOS 8.3 - no issue

iOS 9.2.1 - no issue

2

There are 2 answers

0
Guy S On

The only solution is to use the Web Audio API.

I found out that https://github.com/goldfire/howler.js/ is a great wrapper that make it easy to use.

Good luck

0
mtkopone On

I ran across the same issue. For a slightly complex workaround, it turns out that using the Web Audio API worked even when the "webapp" was saved to the ios home screen. See the following:

Some of the examples use a deprecated API. For example:

  • noteOn(x) is now start(x).
  • createGainNode() is now createGain()