SpriteWrench Posted April 7, 2014 Share Posted April 7, 2014 Hey Everyone So I have an issue. I'm currently loading music at my load screen as seen below: if (this.ready===true && this.cache.isSoundDecoded('someChords') ) { //this.ready=true; //hide loading css document.getElementById('ball').style.display = 'none'; //show game document.getElementById('tapjuggler-game').style.display = 'block'; this.game.state.start('menu'); } However, I'm finding that its taking forever on mobile devices (PC seems fine). I'm trying my best to troubleshoot the problem but I'm completely unsure of what to do. Is the file too big? Is there another way to "wait" for the file to start playing before moving to the next scene? Any help would be appreciated. Link to comment Share on other sites More sharing options...
rich Posted April 7, 2014 Share Posted April 7, 2014 The delay is the audio file decoding. It's most likely an mp3, yes? The solution is to use a different format / codec. Link to comment Share on other sites More sharing options...
SpriteWrench Posted April 8, 2014 Author Share Posted April 8, 2014 The delay is the audio file decoding. It's most likely an mp3, yes? The solution is to use a different format / codec.Yep, originally tried mp3. Tried this with ogg as well, no significant improvement. What audio format(s) would you suggest? Link to comment Share on other sites More sharing options...
qdrj Posted April 8, 2014 Share Posted April 8, 2014 I suggest to use ogg/m4a for music loops and wav for sfx. Link to comment Share on other sites More sharing options...
SpriteWrench Posted April 8, 2014 Author Share Posted April 8, 2014 I suggest to use ogg/m4a for music loops and wav for sfx.Like I stated I tried it with ogg already. Will try m4a format and see. Link to comment Share on other sites More sharing options...
SpriteWrench Posted April 13, 2014 Author Share Posted April 13, 2014 Thanks for the help everyone. So ive tried m4a format... and yeah, it still takes a while. Any other suggestions? Link to comment Share on other sites More sharing options...
rich Posted April 14, 2014 Share Posted April 14, 2014 Use shorter music? Seriously... the decoding time for ogg/m4a is tiny compared to mp3, so if it's still taking ages to actually decode then you need to look at how you're encoding it, or just how long it is in the first place. There are many different ways to encode an audio file, lots of different bit rates, codecs, etc. Whatever you've picked your mobile obviously isn't very happy about, so try others. Nick an audio file from another html5 game that decodes / plays fast for you and then look at how it was compressed and copy those settings. Link to comment Share on other sites More sharing options...
SpriteWrench Posted April 16, 2014 Author Share Posted April 16, 2014 Use shorter music? Seriously... the decoding time for ogg/m4a is tiny compared to mp3, so if it's still taking ages to actually decode then you need to look at how you're encoding it, or just how long it is in the first place. There are many different ways to encode an audio file, lots of different bit rates, codecs, etc. Whatever you've picked your mobile obviously isn't very happy about, so try others. Nick an audio file from another html5 game that decodes / plays fast for you and then look at how it was compressed and copy those settings. Thanks. I think i'll try and do just that. Just wanted to make sure there wasn't something small optimization wise programtically I was overlooking. Link to comment Share on other sites More sharing options...
Recommended Posts