Ahmed Khalifa Posted January 3, 2017 Share Posted January 3, 2017 Hello everyone, I read lots of articles about android being terrible in decoding audio. But I don't understand. I run my phaser game on android in browser it work perfect with sound and music and it work perfect when its wrapped with Cordova only. The problem is when I integrate crosswalk in it, no sounds are playing at all and when I order the loading screen to wait till decode just a 1 second long sound file (mp3, 44100) it doesn't continue, just stuck there. I tried cordova-media-plugin and still nothing is working. I am using the latest crosswalk and latest cordova. Any help plz, Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 There are is a phaser function that has an audio on decode callback... Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 Just now, PhasedEvolution said: There are is a phaser function that has an audio on decode callback... What does that mean? I tried to disable decoding and launch the game and just do the decoding with playing and sound doesn't come out. Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 game.sound.setDecodedCallback(my_music, function () { // start game for example }, this); Something like this should go on a init game state where you load your sprites, etc Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 what is the difference between using the above with callback function vs checking this function? this.cache.isSoundDecoded("SfxName") Shouldn't both be the same? Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 2 minutes ago, Amidos said: what is the difference between using the above with callback function vs checking this function? this.cache.isSoundDecoded("SfxName") Shouldn't both be the same? idk :/ Probably it is the same ^^. Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 That's the problem, it never finish if you are using crosswalk Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 2 minutes ago, Amidos said: That's the problem, it never finish if you are using crosswalk I remeber using intel xdk and having crosswalk active and the audio loaded just fine. I used what I showed you. You could give it a try. There might be a difference... Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 I tried it and it taking forever, here is the apk www.amidos-games.com/testing/csquare-forever.apk Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 Don't you get any console errors? Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 Since iOS doesn't use the crosswalk so it works fine, android without crosswalk works on some devices fine but I need crosswalk to make sure all devices are running smoothly and as soon as I use crosswalk, the game start and sounds is never played. Does I need the full path instead of relative path for crosswalk? Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 Do you mean installation path? I don't think so. This is just throwing something to the air but is it possible that your audio files format is not supported? Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 No I mean when you load ur sound files. For example that what I am using now which is relative path to the index.html this.game.load.audio("Music1", ["assets/CSquare - Track 1.mp3"]); In this case the path is "assets/CSquare - Track 1.mp3" or should I use something else? Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 8 minutes ago, PhasedEvolution said: Do you mean installation path? I don't think so. This is just throwing something to the air but is it possible that your audio files format is not supported? I tried ogg and mp3. mp3 is the most used extension Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 // load audio game.load.audio('audio_key', 'audio/audio.mp3'); var my_audio = game.add.audio('audio_key'); game.sound.setDecodedCallback(my_audio, function () { StartGameState(); }, this); It doesn't use absolute path, no. It is relative to your index file Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 3, 2017 Author Share Posted January 3, 2017 1 minute ago, PhasedEvolution said: // load audio game.load.audio('audio_key', 'audio/audio.mp3'); var my_audio = game.add.audio('audio_key'); game.sound.setDecodedCallback(my_audio, function () { StartGameState(); }, this); It doesn't use absolute path, no. It is relative to your index file I am doing the same and its not working Link to comment Share on other sites More sharing options...
PhasedEvolution Posted January 3, 2017 Share Posted January 3, 2017 Just now, Amidos said: I am doing the same and its not working Sorry then :/ I don't know... Link to comment Share on other sites More sharing options...
bruno_ Posted January 4, 2017 Share Posted January 4, 2017 I got better results with ogg files Link to comment Share on other sites More sharing options...
Ahmed Khalifa Posted January 4, 2017 Author Share Posted January 4, 2017 What I found out is I need to use the beta version of crosswalk to make it work <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library_beta:23+" /> triptych 1 Link to comment Share on other sites More sharing options...
Recommended Posts