Telash Posted February 19, 2014 Share Posted February 19, 2014 Hey guys,I've tried adding some sound to be played at the end of a tween, which works great on my desktop... however for some reason it dosn't work AT ALL on any of the mobile devices (including tablets) i've tested it on.tween.onComplete.add(this.playTap, this);Any idea's? Link to comment Share on other sites More sharing options...
rich Posted February 20, 2014 Share Posted February 20, 2014 Has the audio loaded? (what file format are you using - if it doesn't play at all, it's usually a file format or bitrate issue). Link to comment Share on other sites More sharing options...
Telash Posted February 20, 2014 Author Share Posted February 20, 2014 Hey Rich, thanks for replying Has the audio loaded? (what file format are you using - if it doesn't play at all, it's usually a file format or bitrate issue). I have the following code to ensure it's loading in my preloader: if (this.cache.isSoundDecoded('diceSFX') && this.ready == false) { this.ready = true; this.game.state.start('MainMenu');}The formats i have tried with so far are .wav and .mp3 Edit: After further testing (and adding the .ogg format) it seems to work fine on the ipad min but not the galaxy tab2 or a HTC windows 8 phone, also it seems to crash the Samsung Galaxy S4 browser after playing the audio?this.load.audio('diceSFX', ['assets/sfx/tap.mp3', 'assets/sfx/tap.ogg', 'assets/sfx/tap.wav']);var tween = this.add.tween(BasicGame.diceObj[i]).to({ y: BasicGame.yFloor - (BasicGame.diceSize * row) }, 500, Phaser.Easing.Quintic.In).delay(100*i).start(); tween.onComplete.add(this.playTap, this);playTap: function () { this.tapSFX.play(); this.countTaps++; if(this.countTaps == 9) { this.countTaps = 0; this.playGame(); } } Link to comment Share on other sites More sharing options...
Telash Posted February 21, 2014 Author Share Posted February 21, 2014 Any ideas? Link to comment Share on other sites More sharing options...
rich Posted February 21, 2014 Share Posted February 21, 2014 What bitrate is your mp3 in? There are lots of rates browsers can't play Link to comment Share on other sites More sharing options...
Telash Posted February 21, 2014 Author Share Posted February 21, 2014 That would be 192kbps good sir Link to comment Share on other sites More sharing options...
rich Posted February 21, 2014 Share Posted February 21, 2014 Ouch - you may wish to revise this Start at the lowest possible then work up! (testing across device as you go). I've never managed to get as high as 192 yet Link to comment Share on other sites More sharing options...
Telash Posted February 21, 2014 Author Share Posted February 21, 2014 Ouch - you may wish to revise this Start at the lowest possible then work up! (testing across device as you go). I've never managed to get as high as 192 yet Ah I see Thanks for the info Rich. Link to comment Share on other sites More sharing options...
rich Posted February 21, 2014 Share Posted February 21, 2014 Alternatively - find an html5 game that has sound and works across all your target devices. Then nick the audio files they use and inspect them and match the codec/bitrate Link to comment Share on other sites More sharing options...
codevinsky Posted April 3, 2014 Share Posted April 3, 2014 Did any of these suggestions help? Link to comment Share on other sites More sharing options...
InsaneHero Posted July 31, 2014 Share Posted July 31, 2014 Sorry to necro but this is entirely relevant to a problem I've just encountered... is there a guide or set of recommendations for audio formats and settings? There are thousands of potential problem devices and millions of combinations of format/compression/headers/etc for the audio files. I'm sure someone has found a working combination that does the job on most devices - so if they could share that'd be lovely I've just found that mp3/wav doesn't work on my iPad2 in the Chrome browser, but I let Audacity batch with it's default mp3 settings so I need to look into that in the meantime (especially as they crackle something shocking on IE desktop). Please ignore this, I didn't know about 'touch the screen to unlock audio'... Link to comment Share on other sites More sharing options...
lewster32 Posted July 31, 2014 Share Posted July 31, 2014 There have been other posts that discuss this - the common consensus is that a combination of mp3 and ogg vorbis files works in the majority of cases, and you can if you want replace mp3 with m4a to avoid potential legal issues. Link to comment Share on other sites More sharing options...
Recommended Posts