Question about audio on mobile web browsers

Hi guys,

I’m seeing a weird behaviour here in regards to the audio engine when the game runs on mobile web browsers ( safari and chrome).

I’ve attached a test project which can be used to reproduce this. When the game first loads after entering the url, do not interact with the canvas in the browser, the sound would not start playing, the sound will only start playing when the user touches the canvas. If the the game tries to call audioengine to stop the sound when it is in this state, audioengine would ignore this command.

In this test scenario, I’m playing a sound in one scene, and then stopping the music before navigating to another. In the other scene, I would play a different sound on load. In such a case whereby the user does not interact with the game before the scene transition, there would be two sounds overlapping each other when the sound does start playing.

Has anyone a solution to this problem?
assets.zip (100.2 KB)

regards,
Kevin

Hi Kevin,

please upload a full project zip, the current one contains only the assets folder.

Best regards,
Zsolt

Hi,

Sure, although the assets file can be included into a new project and should work regardless.

TestAudio.zip (263.1 KB)

regards,
Kevin

Hi Kevin,

I can confirm that it works fine on the following devices:

  • Simulator (CC 1.5.2),
  • Edge (Windows 10),
  • Chrome (Windows 10, Android 7.0, Android 6.0.1, Android 4.4.2).

And it does not work without touching the screen:

  • Chrome (iPad),
  • Safari (iPad).

It seems that this is a known bug of OSX/iOS, see the following forum:

Best regards,
Zsolt