Music not playing on Mac/Safari

Get help using Construct 2

Post » Fri Mar 24, 2017 11:23 am

Hi everyone,

I have big troubles playing music on a desktop Mac using Safari. I tested my game on two different hardwares and the result is the same: No music is actually playing.
I am fully aware of the iPad/iPhone limitation that music only starts playing when a touch occurs, and the game is designed to take that into account. However, the problems mainly happen on desktop. (It also happen sometimes on iPad, but most of the time the music plays correctly)
I could resolve the problem by placing the music in the sound folder, but as you know the download would much heavier, so I would like to avoid that if possible.
When playing the game on Chrome on a Mac desktop, the music plays correctly.

Any idea/solution for this problem?

If you want to test it for yourself : http://test.smurf.com/snowballs54/
(the menu music is actually placed in the sound folder, so it will play even on Safari)

Thanks !
B
32
S
6
G
1
Posts: 353
Reputation: 2,821

Post » Mon Mar 27, 2017 6:57 am

Make sure music files are not 00:00 length, instead of using Construct 2 event for Music Play Try this out,

- Add Browser instance in Game,
- Add an event of Execute JavaScript at that required location where you want to play that Audio.
- Write this event into it.

"var sound=new Audio('media/sound.mp3');sound.play();"

change the URL as per your requirement.
Media is the Folder and sound.mp3 is the file name.

Do let me know if this works.

Btw checked your game, Its amazing. Loved it.
B
4
Posts: 4
Reputation: 208

Post » Mon Mar 27, 2017 2:36 pm

Hi @alimuqaddas , thanks for your help and kind words. ;)

I tested your solution, here is how the execute javascript looks :
"var sound=new Audio('Music/mymusic.m4a');sound.play();"

I guess that's how you meant it to be done?
Sadly, it doesn't work better than with the C2 audio plugin.

The command line seems to work, as the music is playing correctly on Safari installed on a PC or from an iPad. It doesn't work in other browsers (which is normal, as I just launch the .m4a file and other browsers require .ogg files), and doesn't work either on Safari from a Mac.

Sorry. :(
Any other solution for this problem? Anyone else experiences it?
B
32
S
6
G
1
Posts: 353
Reputation: 2,821


Return to How do I....?

Who is online

Users browsing this forum: norman74, ome6a1717 and 17 guests