HTML5 game - works in IE, Chrome. Crash in FireFox ... Until I go to the .mp3 file ... Then it works
I am using the games library ( http://html5quintus.com/ ) to try and make a very simple 2d platformer. I don't think this is necessarily related to the development of the game. I am just trying to play some audio files.
I am using FireFox 31.0 - (latest AFAIK).
The audio files I deal with are all .mp3 files. The line of code that appears to be causing the problem:
Q.audioContext.decodeAudioData(request.response, function(buffer) {
callback(key,buffer);
}, errorCallback);
The error I am getting:
The buffer passed to decodeAudioData contains invalid content that cannot be decoded successfully. localhost: 50796 uncaught exception: Error Loading: jump.mp3
What I find most confusing is that if I go directly to an audio file (/audio/jump.mp3), FireFox will play that audio file correctly.
Here's where it gets really weird ... AFTER I load any of the .mp3 files. If I go back to my game and restart it, it suddenly starts working completely. All sounds / background music works and everything is the same as in IE and Chrome. But if I don't download the .mp3 file first, it doesn't.
Once the game is running I can close that tab / open a new tab and visit the url and it works again. It seems to keep working fine until I quit FireFox completely. Then the game won't work until I go directly to the .mp3 file.
Can anyone tell me what I did wrong here?
source to share
In my project, decoding worked great for months until this morning. So these are not audio files, this is not a caching problem, this error only appears in Firefox (I have v31.0), in other browsers (both desktop and mobile) it works fine. So I would say that this is a Firefox bug, one of which, unfortunately, I don't have a solution yet. Will be updated if I find anything.
source to share
How does it work (for FireFox 31); if I add a normal audio tag to my static loading page, when the game engine starts loading its resources, FireFox will accept .mp3 files.
<audio src="audio/coin.mp3"></audio>
If I include this line everything works on all major browsers. If I remove this line, FireFox 30 works, but FireFox 31 fails :( Yuck.
source to share