Sound in phonegap export

Get help using Construct 2

Post » Sat Jan 28, 2012 12:08 am

of course, that's why I said that it works, but if this was the way I wanted to work I wouldn't buy C2 now would I? :) I really hope this can be sorted out and working in a near future as a game without sound is no game. also I believe in scirra guys, I've been here since some really early versions of construct (classic) and seen things they can do, so no reason to stop doing them now, right? :)

also I quite don't understand why this is not a first priority issue for now :) lack of audio on a mobile game is a HUGE problem. I understand that phonegap support is experimental, but if you can make audio work there with a little bit of hack, why it cannot be implemented into the C2. also I think, if phonegap support would be done in a way that more and more phonegap's features would be implemented, C2 would become a number one mobile game creation tool.ranma2012-01-28 00:10:42
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Jan 28, 2012 11:56 am

Phonegap has native audio plugin for iOS & Android if you need them (you need to add them in the directory, though).
By the way, PhoneGap is free also, even if Adobe bought PhoneGap, there's still open licences that it needs to respect.

If you want audio with PhoneGap, edit the index.html, and add a <script> which preloads all audio. You can then call the script from inside C2 with the CallJS plugin. Problem solved ;)
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Sat Jan 28, 2012 12:11 pm

@Pode, What do i have to call with the CallJS plugin? I looked at there API docs, There was too much stuff for me to figure out what i need.
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Sat Jan 28, 2012 1:56 pm

you need to make calljs load external js file which contains all your media:

var sound1 = new Media(src);
var sound2 = new Media(src);
... so on.

and whenever you need to play sound, call javascript:

sound1.play();

this has some problems though, tested in on start of first layout, and for some reason calling just sound1.play() didn't work, but calling alert('play sound');sound1.play() worked.

also this should really be implemented somehow automatically by construct export hopefully in some of the next releases right?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Jan 28, 2012 10:38 pm

We use PhoneGap's Media API to play audio when you export to PhoneGap, but it appears to simply not work. I have no idea why not. I'll have a look in to fixing it for the next build but I was disappointed with the results and heard it had other problems anyway from other PhoneGap developers.

PhoneGap's priorities currently seem to be around apps and not games so I'm not sure if they're going to fix game-related issues any time soon. Some PhoneGap plugins exist that can help, but PhoneGap Build doesn't support plugins yet. Without PhoneGap Build you have to download hundreds of megabytes of development software and go through a really complicated setup process, so PhoneGap Build really is the only way to go IMO.

I haven't got a great deal of experience using AppMobi myself, so I can't comment much, but I did seem to get Space Blaster working OK on my iPad via AppMobi so I'm not sure what "no tablet support" really means. IMO if it works use it, and I'd be interested to know how it goes for you.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Sun Jan 29, 2012 12:36 am

For me actually it works great (was cheering for phonegap but appmobi just seem to work without any issues at all) and you can use appmobi api to do lots of fun things (vibrate for example) that are not iplemented in C2. So for me it's appmobi now.ranma2012-01-29 00:37:37
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Previous

Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 21 guests