How do I get music to play in web browser?

Just started using Construct 2? Post your questions here

Post » Sat Dec 31, 2016 4:48 am

Hey guys

Loving the program but for some reason I cannot for the life of me get music to play in my background when I run my HTML5 game on Safari on iOS. This is across a bunch of different iOS devices. Any browser on a PC it works perfectly :( .


I tried messing around with preload but I don't think it's working or that wasn't the problem.

Any clue?

splashdown.lipowered.com/hncc
Last edited by ludacrisangel on Wed Feb 01, 2017 3:25 pm, edited 1 time in total.
B
5
S
1
G
1
Posts: 3
Reputation: 831

Post » Wed Feb 01, 2017 3:24 pm

Anyone? :(
B
5
S
1
G
1
Posts: 3
Reputation: 831

Post » Wed Feb 01, 2017 5:49 pm

Yes I've encountered this before. You'll need to put a touch to play screen or something similar in before that intro movie. From ze manual :

Mobile limitations
Safari on iOS and Chrome for Android share a limitation in playing music. While sound effects can be played at any time, music is only allowed to start playing when the user touches the screen. This is a limitation in the browsers themselves. As a result, if you play music on the start of layout, you may find in these browsers it does not actually start until the next touch.

Safari on iOS has a further limitation that no audio can play at all until the first touch. In other words, audio starts off muted and the first touch unmutes audio playback.

Usually you do not need to handle this in your events. If you try to play sound or music on 'start of layout', the audio object will automatically queue it up for playback the next time the user touches the screen. However you should be aware of this when designing your game. If the first touch changes layout or stops the music, then the music may never be heard. You may want to start playback then encourage the user to touch the screen with a 'Play' icon or something similar.
B
46
S
16
G
76
Posts: 2,150
Reputation: 45,313

Post » Fri Feb 24, 2017 12:57 am

thank you thank you thank you
B
5
S
1
G
1
Posts: 3
Reputation: 831


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests