Sound not playing on Safari & iOS 6+

  • I have created a very basic sound test project where you click on a large sprite and it plays a sound. The sound plays fine when you load the project and click on the sprite in Chrome but not in Safari or on iOS 6+. I have used the Touch object to capture the click on the sprite and trigger the play sound action. I have tried both preloading and not preloading the sound with no change.

    Here is a link to the full exported project on Dropbox:

    dl.dropboxusercontent.com/u/8856086/PianoTestWeb/index.html

    The audio file alone is downloadable and playable in Mac Safari and iOS 6+:

    dl.dropboxusercontent.com/u/8856086/PianoTestWeb/media/A.m4a

    The .capx file is here:

    dl.dropboxusercontent.com/u/8856086/PianoTestWeb/1Key.capx

    What am I doing wrong?

  • You should mention which compiler you use in case of iOS

  • Works fine on an iPad 3 running iOS 6 here.

  • hmm...

    I just cleared the cache on the iPhone 5 and reloaded. Everything seems to play as it should. Sorry for the distraction. It's the little things that get you ;-)

  • I spoke too soon. I exported another copy to dropbox and now it doesn't work in Safari anymore. This is really strange. Is Dropbox doing something strange or is something else going on? Is sound so inconsistent on Safari. Sound seems to work in Chrome even when it doesn't work in Safari.

  • Ok - I made a few mods making the sound playable by either clicking/touching on a sprite or Text object. Just to check that clicks/touches are being received I made the sprite rotate 90 degrees on every click/touch as well. The sound also plays once after layout is loaded initially.

    Now Mac Safari crashes while trying to load the file. Earlier it would not play the sound but did not crash. Once it locked up my iPhone 5 and I had to force power off and restart. Works fine on Chrome.

    Dropbox URL: dl.dropboxusercontent.com/u/8856086/PianoTestWeb/index.html

    Capx: dl.dropboxusercontent.com/u/8856086/PianoTestWeb/G.capx

    Is there some trick I am missing?

  • I have huge problems with sounds on ios (all devices, all versions) which is our main target as a platform. I have had too much issues with cocoon so that is not an option.

    My issues are:

    * Not all sounds are playing, only some, but this seems to be somewhat random

    * When the page is reloaded, and the files are probably cached, no sounds are working

    Unfortunately there seems to be little to no help here and I'm soon at my deadline so I will have an unsatisfied customer. I won't blame anybody and I understand that the problem is complex, but since ios is such a popular os, I would hope for more discussions on how to find workarounds rather than just hints to contact apple and get them to fix safari. It's like talking to a brick wall.

    I am constantly looking at options and my team has spent a few weeks only to try to solve this specific issue with no luck.

    One thing is for sure, if this is not solved, I won't get more jobs using this technique and I will have to switch to something that works.

    I will try to summarize our research when I have the time and maybe we can work something out together.

  • jeansson, any luck with this? I have a publisher that is purchasing one of my games and they are experiencing the same issues with sound on their iOS devices. I might try going back to LowLatencyAudio and seeing if it helps. scirra.com/tutorials/283/phonegap-low-latency-audio Even though I am not using phonegap, it might solve the issue.

  • If it works fine on local machine but crashes on remote version, would it be the problem of sound file preload? I've encountered similar problem and solved after removing all preload functions.

  • ArcadEd : most html5 games currently feature no sound. It seems like iOS and android at least, the support is pretty bad at the time.

    We just tried it on an html5 game we just finished with my teammate, and we do have the cache problem on ios, and the sound not looping on android.

  • The publisher said others devs have gotten it working by using audio sprite sheets. http://www.ibm.com/developerworks/web/library/wa-ioshtml5/ about 3/4 of the way down.

    I'm going to gather more info from those other devs and see how they did it.

  • Ashley

    Just curious if you had any thoughts or ideas on this? Thanks.

  • The article is out of date. Audio sprites are redundant because Safari supports the Web Audio API.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    Is it possible to include option in Audio object to force preload all audio during loading time ? I`ve uploaded my game to few publisher, they all keep coming back to me about the audio a bit stutter sometimes.

    For me, I just need to preload all my audio and put some custom loading screen during preloading.(Kinda like please wait thing)

    If I play flash games online, I noticed that almost all of them have a bit long loading time before the game start.

    So can I suggest few things in Audio Object properties?

    Force preload-

    1)preload all Sound Files

    2)preload all music files

    3)preload all audio

    4)disable (default)

    All the preloading is done in the first loading screen.This will make loading screen a bit long, but at least it wont effect the gameplay.

    Is it ok ?

  • Well apparently it still isn't working. Both of their devices are running iOS 6 and both get no sound.

    Is there something else I should be doing besides preloading sounds on Layout Startup?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)