0 Favourites

Music not playing on Mac/Safari

  • 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 !

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
763 305,737
asikanddestroy's avatar
asikanddestroy
Unread hot topic
378 33,278
part12studios's avatar
part12studios
Unread hot topic
302 48,110
Eric Matyas's avatar
Eric Matyas