Yanifska Posted March 24, 2015 Share Posted March 24, 2015 Hi, I am having trouble playing ogg on android stock browser.The game will play fine, but no music.The sound will play fine on android chrome though, or ios with m4a.this.game.load.audio('gameMusic', ['assets/audio/sneaking.ogg', 'assets/audio/sneaking.m4a']);I have tried a few random quality settings for the ogg that didnt worksHowever the ogg file in this link works (on the android device of course), so I downloaded it and it wont work in my game neither. How can I debug / fix that ? thanks ! Link to comment Share on other sites More sharing options...
Westinghouse Posted March 24, 2015 Share Posted March 24, 2015 Look at http://html5test.com/ what audio codecs are supported. So you can be sure is not a problem with the browser itself. Link to comment Share on other sites More sharing options...
alex_h Posted March 24, 2015 Share Posted March 24, 2015 Android stock doesn't support webaudio so it is trying to play your file through HTML5 audio tag as fallback. There's nothing wrong with the ogg audio file, but due to the nature of sound played through the audio tag rather than web audio it will behave differently, eg sounds can't be preloaded, will have lots of lag, only one sound at a time, etc. Depending on what you are trying to do with it it's most likely your requirements are conflicting with the restricted capabilities of the sound engine in this mode. Link to comment Share on other sites More sharing options...
Yanifska Posted March 24, 2015 Author Share Posted March 24, 2015 Thanks guys, Aex, thank you it explains a lot.How can I find more info about these restrictions?I am just trying to play a single background music but indeed I am preloading.Have any suggestion ? What is the common solution for this problem ? Yaniv Link to comment Share on other sites More sharing options...
alex_h Posted March 24, 2015 Share Posted March 24, 2015 I haven't used Phaser a lot myself but when I last looked at its audio engine it was designed to handle switching between web audio and HTML audio tag transparently so in theory you shouldn't have to do anything and it should just work. The fact that it isn't working suggests that you are most likely doing something that will only work with web audio. I would suggest having a quick look at the Phaser source to see if you can identify where it is failing.Or set up a bare bones test project with a button that plays a sound and see if this works in the android stock. If it does, use that to work out where your game is going wrong. Link to comment Share on other sites More sharing options...
Yanifska Posted March 24, 2015 Author Share Posted March 24, 2015 thanks,I'll try to do that Link to comment Share on other sites More sharing options...
Recommended Posts