[QUESTION] Audio in PhoneGap & AppMobi

Discussion and feedback on Construct 2

Post » Thu Mar 08, 2012 10:45 am

Hello,
I've create a simple game where there are 4 sounds:
- background music (C2 music folder)
- player jump effect (C2 sound folder)
- shooting effect (idem)
- explosion effect (idem)

I've exported it for Android (v.2.3) in 2 version, one with PhoneGap and one with AppMobi, and played on SmartPad 810C res.800x480.

The game runs ok, physics a little slow, but acceptable.

I've noticed that the audio:
- in PhoneGap is ok, all sounds are executed, but the music doesn't go in loop (in C2 I don't see an event like "sound is playing" that could help me to force looping);
- in AppMobi sounds start only as soon as I do something (for example, I move the player) and the music stops after some seconds.

Some opinions?

Thanx,
Stevenstevenworks2012-03-08 10:50:15
B
16
S
3
G
4
Posts: 32
Reputation: 1,911

Post » Thu Mar 08, 2012 12:29 pm

The difference between Music and Sound folders aren't the looping or not looping once started, but preload or not.

All files inside Music will be avaialable within stream (so it won't delay game start), while all files inside Sound will be available right when game starts, because it's downloaded with contents. (at least for me works like this)

So, to loop, once you Start/Play sound, just choose Looping -> looping on the popup, or, make a condition to set the tag sound to loop.
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 110
Reputation: 3,225

Post » Thu Mar 08, 2012 12:45 pm

Cassiano, thanx for the replay, but sorry, what you say isn't the question I've proposed.

I know how the folder works and how to activate the looping, infact I set properly the loop for the music, loaded in Music folder because I want that it's streamed and the effect in Sound folder for immediate availability.

The game I created works perfectly in the browser: all sounds play, music is correctly in loop, all goes ok.

The problem is only on Android Tablet, when I convert the game in an Android App with PhoneGap and with AppMobi, as I've explained...

Steven
B
16
S
3
G
4
Posts: 32
Reputation: 1,911

Post » Thu Mar 08, 2012 1:13 pm

Oh i see...

And about forcing the loop, did you tried something like

Every tick
- set <tag> to looping

?
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 110
Reputation: 3,225

Post » Thu Mar 08, 2012 2:22 pm

I don't think either PhoneGap or appMobi's audio engines support looping.

PhoneGap supports the 'On ended' trigger, so you can do 'On music ended -> play music'. I haven't managed to get appMobi to support that one yet though, so for appMobi you'll just have to do something like "Every 30 seconds -> play music" (and work out how long the music track actually is).
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544


Return to Construct 2 General

Who is online

Users browsing this forum: Aphrodite, MilkGames and 6 guests