lenten1111 Posted August 12, 2014 Share Posted August 12, 2014 Hello, I have a few games which run good on desktop and not bad on android with geckoview (app size too big because of geckoview). Now i'm trying to bring them to WP8 and maybe reduce android app size with phonegap. But problem about audio, there no audio working (the same with cocoonjs, i tried). I also tried use phonegap media api, its working but i can't figure out how to use phonegap api inside my phaser game state. Could somebody please give me an example how to use phonegap api inside my phaser game state? Thanks Link to comment Share on other sites More sharing options...
JP91 Posted August 12, 2014 Share Posted August 12, 2014 maybe this will help. http://www.html5gamedevs.com/topic/5615-audio-is-not-working-on-phaser-game-wrapped-by-phonegap/ Link to comment Share on other sites More sharing options...
lenten1111 Posted August 12, 2014 Author Share Posted August 12, 2014 Yes, i read that, but what i mean an example about how to add phonegap media api inside phaser state, i dont know how to do? im newbie Link to comment Share on other sites More sharing options...
Videlais Posted August 12, 2014 Share Posted August 12, 2014 As with the thread @JP91 links to, you will need the Media plugin for Cordova/PhoneGap to play audio files. Instructions for installing and using it can be found on its GitHub page. (In the last couple of days, I've also started to patch Phaser for greater Cordova/PhoneGap support too. Greater compatibility is coming.) As for CocoonJS (and ultimately the Media plugin as well), you need to check file formats. Certain devices will only play certain types. In most cases, WAV is universally playable; OGG for Android and MP4 for iOS. (We keep track of the CocoonsJS-specific issues in this thread to help people out with that library.) Link to comment Share on other sites More sharing options...
lenten1111 Posted August 12, 2014 Author Share Posted August 12, 2014 Yes, i know how to use phonegap media api, its working good. My problem is how to embed phonegap audio code inside phaser play state which have animations, audio for each animation. It like how to get 2 different codes work together, an example like that. Link to comment Share on other sites More sharing options...
Videlais Posted August 12, 2014 Share Posted August 12, 2014 My problem is how to embed phonegap audio code inside phaser play state which have animations, audio for each animation. It like how to get 2 different codes work together, an example like that. I don't know of any tutorial or example for that, unfortunately. I've started looking at ways it might be possible to write a patch to add in Cordova.Media support into Phaser's existing Loader and Audio objects, but haven't made too much progress yet. Because Cordova.Media doesn't conform to the W3C specification, I've been researching ways to either add some conditional loading or just write a plugin for Phaser that overwrites the audio object as Media. Link to comment Share on other sites More sharing options...
Videlais Posted August 12, 2014 Share Posted August 12, 2014 It's not a full patch yet, but if anyone absolutely needs audio to play using Cordova and Phaser, here is a patched version of Loader.js. (Download and replace the original Loader.js in Phaser source and then do a full re-build to use.) Link to comment Share on other sites More sharing options...
lenten1111 Posted August 13, 2014 Author Share Posted August 13, 2014 Wow thanks for your patch, I added yours in phaser.js and its working now with phonegap api, but still have issue, we still cant play multi sounds at the same time. So i think i will wait for full patched, thank you again for your work. Link to comment Share on other sites More sharing options...
Videlais Posted August 13, 2014 Share Posted August 13, 2014 I'm glad it is working for you. I plan to do more testing today and hopefully submit the patch within the week. I looked into the multi-sound issue and noticed that the Cordova.Media page on Github mentions that Windows Phones can only play a single media file at a time. Link to comment Share on other sites More sharing options...
Recommended Posts