wombat

Android: Sound works in Chrome but not in stock browser

Recommended Posts

On android I can play my game in Chrome and Firefox browsers, but on the stock browser there's no sound. Any ideas where I should start looking? I have my sounds encoded as ogg and mp3.

 

Edit: the game in case someone is interested :)

Share this post


Link to post
Share on other sites

I would hazard a guess that you are only hearing the sounds working when the game runs in a browser that supports WebAudio. The stock browser does not support Web Audio, it only supports HTML5 sound which is much more limited. As for specifically why the sound in your game is not working for HTML5 audio I couldn't tell you without rummaging through the code.

Share this post


Link to post
Share on other sites

Thank you. Since I believe the .ogg files are loaded as first choice, I guess there's something with the encoding of these that the native browser doesn't like. Not loading these (using just mp3) works, until I figure out what is wrong with the oggs.

 

EDIT: Turns out I didn't change that at all, I only thought I did. Instead, sound seems to have started working mysteriously on it's own accord. Hm. Sorry for wasting your time folks, if I come up with something useful I'll post it here.

Share this post


Link to post
Share on other sites

Hi wombat,

I am running in the same issue.

I am using ogg and m4a, I got it running in chrome/android and safari/ios.

However stock android browser won't play the file.

I test on a samsung galaxy tab 3 lite.

 

Could you share the ogg setting of your files ?

I'll probably try and use different compression settings I guess
 

thanks

Share this post


Link to post
Share on other sites

@Yanifska: I'd like to help but I don't remember. The .ogg files were created in Audacity, and if I load one back it says Stereo, 44100Hz, 16-bit PCM. I don't know if that's the setting your'e asking about. The link above is still valid though if you want to have a look at the .ogg files yourself.

Share this post


Link to post
Share on other sites

Hi there,

 

unfortunately I didn't see wombat last answer and I didn't dig more the subject lately.

I am stuck on some freelance stuff for now.

I'll update when / if I find a solution.

 

so good luck in the meanwhile, keep me updated If you have more success than me ;)

Share this post


Link to post
Share on other sites

Make sure your sounds are loaded & decoded before playing them.

 

Decoding takes ages on Android for web audio, and it's even worse with the audio tag. In the most cases it will only load a few bytes of your sounds, and make a request to the resources when you need to play it, thus there could be an important latency.

 

You can also check the value pendingPlayback of your sound in order to know if it's in the process of playing it.

Share this post


Link to post
Share on other sites

@BunBunBun it works ! thanks man

I would not have thought about that because ios request to have the user touch the screen before playing the sound

the trick was that the android native browser need the sound to played directly after the input

thats why the audio was working on iOs but not stock android

makes sense ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.