Jump to content

Audio on Android Stock Browser


sharbelfs
 Share

Recommended Posts

I'm having a problem trying to play a sound on Android Stock Browser.

 

I'm working on a music game, so, after x seconds I need to play a note, it worked on chrome (android an ios) and safari, but not on the android stock browser.

 

I tried to use an audiosprite with all notes and standalone audio files. (with decode audio validation)

I used .mp3 (128bits/192bits, 44800hz) and .ogg (24bit, 44100hz/48000htz), with no success so far,

 

does anyone can help me?

 

thanks,

Link to comment
Share on other sites

The stock browsers' audio behaviour varies with the android version, the device and the rom installed on it.  It also varies with the parameters used to encode the sound and sometimes even the software used to encode them.

 

BUT having said that, I get good results on android with ffmpeg encoded .ogg's @ mono 44.1kHz 128k

 

The 'after x seconds' bit sounds a bit suspect, reminds me of behaviour of some devices not to keep quiet until initiated in code from a user input.

 

Maybe your problem isnt anything to do with file formats.  Why don't you post a link to a demo exhibiting this problem.

Link to comment
Share on other sites

thanks @stupot, I'll try that, and btw did you use audiosprite?

 

here it is how my code is working.

at the begin of the level I play one note, after 1.5s I play the second note, and show the buttons for the user to click.

 

ps: at any time in the game I have a click action to play the sound, there is always some effect or timeout before I play the sounds.

 

does it help?

this.sound.play(this.firstNote);this.game.time.events.add(1500, function() {    this.sound.play(this.secondNote);    this.showActionButtons();}, this);
Link to comment
Share on other sites

yes, I use audiosprite to package up the sounds.

 

I don't really use Phaser's sound engine, I find Howler more capable and reliable - but none of them can overcome the mess that is browser audio.  Some things to try though, to see if anything changes to help you home in on the problem.

 

- try a different sound engine

- swap your firstNote and secondNote around

- make firstNote and secondNote the same

- try and stop the sound before playing it

- change the sound from a sound sprite to individual sound files

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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