Ezelia Posted May 3, 2013 Share Posted May 3, 2013 Hi everyone, I'm encoutring a strange behaviour from chrome mobile ... it's not playing my audio files from JavaScriptI tried with audio API (new Audio() ) with buzzjs and howlerjs libraries ... nothing works. the same code works just find with desktop browsers, Android stock browser and Firefox mobile. also, if I include an <audio> tag to the document and try to control the element from javascript I can't play it the fist time, but if I click the play button then the sound start playing and this time I can control it throught Javascript. here is a page with the code example : http://ezelia.com/demo/audio.html the audio should start automatically (check from desktop) ... but on chrome mobile it won't autoplay, you must click on "Play" button any idea ? Quote Link to comment Share on other sites More sharing options...
rich Posted May 3, 2013 Share Posted May 3, 2013 Audio on most mobile browsers (iOS / Chrome) require a touch event before it can start. If using Web Audio all audio is put in a 'scheduled' state until a touch event is received, only then can you play it. Same for audio tag. You need to design your game around it. One of the best ways I've seen is to have audio off by default and on the main menu have a "music on" button - and of course touching it allows you to start the audio going. Quote Link to comment Share on other sites More sharing options...
Ezelia Posted May 6, 2013 Author Share Posted May 6, 2013 Thank you for the information! I was not aware about thatnow it makes sens for me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.