How do I get around mobile audio limitations?

Get help using Construct 2

Post » Wed Sep 02, 2015 9:38 am

Hi guys, OK, so I've started work on trying to make an iPad game, I've read the manual and I understand that mobile browsers have some pretty major limitations in regards to audio, whenever you start a new layout "audio starts off muted and the first touch unmutes audio playback". So , is there a way I can get around this?

The manual gives the example of "start playback then encourage the user to touch the screen with a 'Play' icon or something similar", I mean sure that's a fine solution if you're just making a game with one layout, but in the game I'm designing you're constantly moving to new layouts, so I can't expect the player to have to press 'play' every time they enter a new room.

I'm just wondering if there's a way to event around this problem, or is there any other solutions I'm not thinking of?

Any help would be very much appreciated, cheers :)
B
12
S
4
G
3
Posts: 12
Reputation: 1,464

Post » Wed Sep 02, 2015 11:40 am

Hmm, which manual entry are you looking at? The engine now handles this automatically. In Safari audio will be muted until the first touch because that's a limitation Safari imposes, but you don't need any events to handle this. Also it doesn't reset every layout, it's only once when the project first starts.
Scirra Founder
B
402
S
238
G
89
Posts: 24,624
Reputation: 196,015

Post » Wed Sep 02, 2015 12:39 pm

Hi @Ashley, I read this part of the manual https://www.scirra.com/manual/109/audio under "Mobile limitations".

I'm still very new and I'm a bit confused, I've only tested over wifi so far and every time i switch layouts there is no sound until I touch the screen, maybe this isn't an issue if the game is properly exported but I'm not sure?
B
12
S
4
G
3
Posts: 12
Reputation: 1,464

Post » Wed Sep 02, 2015 6:58 pm

I've been trying all day and I still can't get this to work in the way Ashley says it should, I'm sure it's something I'm doing wrong but I just can't figure it out, I've uploaded a very simple .capx which shows my problem, when previewing on my iPad over wifi the music stops every time you move to a new layout, it will not start unless you touch the screen on every different layout you go to. I would really be grateful if anyone has the time to check out the capx and tell me if I'm making some kind of n00bish blunder, massive thanks in advance to anyone who can help.

https://mega.nz/#!l0UX1KiA!F5JG5MqApVoA ... whrbLGfMCc

Edit: I just tested this on an Android tablet (Nexus 9) over wifi and I get the same result, no music on layouts unless you touch the screen first (not just the first layout, but all of them)
B
12
S
4
G
3
Posts: 12
Reputation: 1,464

Post » Thu Sep 03, 2015 10:52 am

You can basically ignore the limitation and the C2 engine will queue the audio to play on the next touch. Music only starting when you next touch the screen is a limitation in Chrome for Android and Safari on iOS.
Scirra Founder
B
402
S
238
G
89
Posts: 24,624
Reputation: 196,015

Post » Fri Oct 02, 2015 10:31 am

Ashley wrote:You can basically ignore the limitation and the C2 engine will queue the audio to play on the next touch. Music only starting when you next touch the screen is a limitation in Chrome for Android and Safari on iOS.


@Ashley, but it seems that in iOS9, with the touchstart/touchend issue, we can get a situation when the game requires a touch and hold gameplay("is in touch" action), the music will never be triggered, because the first touch never happened, because C2 does not interpret "is in touch" as a "touch start", to trigger the music, or am I wrong.

I don't have iOS 9, but this was reported to me about one of my games.
This is easily solved by trigger the music in a different way, but I thought it worth to mention it.Thx
B
36
S
11
G
9
Posts: 400
Reputation: 10,285

Post » Fri Oct 02, 2015 11:36 am

There's nothing you can do: you can't make a sound on iOS 9 until a touchend event. It's Apple who impose this restriction, not us. The only solution is to adapt your game design to take this in to account.
Scirra Founder
B
402
S
238
G
89
Posts: 24,624
Reputation: 196,015

Post » Fri Oct 02, 2015 11:48 am

@gradius

A common work around when entering a new layout, is to have a dialogue with the level name and some details, with a little "Ok" button below it, required to touch.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Oct 02, 2015 11:54 am

Ashley wrote:There's nothing you can do: you can't make a sound on iOS 9 until a touchend event. It's Apple who impose this restriction, not us. The only solution is to adapt your game design to take this in to account.


OK Ashley thx
B
36
S
11
G
9
Posts: 400
Reputation: 10,285


Return to How do I....?

Who is online

Users browsing this forum: dop2000, irina, Yahoo [Bot] and 5 guests