Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Mobile Audio


Telash
 Share

Recommended Posts

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

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

  • 1 month later...
  • 3 months later...

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'... :o

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...