Browser is choosing m4a instead of ogg and then audio fails to load

I have audio settings something like this. To instruct the browsers that out of mp3,ogg,m4a whatever is compatible, use it.

<assets path="assets/audios"   if="html5">
 		<sound path="gem-ping.mp3" id="gem-ping" />
  	</assets>
   	<assets path="assets/audios"   if="html5">
 		<sound path="gem-ping.ogg" id="gem-ping" />
  	</assets>
   <assets path="assets/audios"   if="html5">
 		<sound path="gem-ping.m4a" id="gem-ping" />
  	</assets>

But the browser ( chrome, firefox) always loads m4a one. And then fails to load the audio. I also tried reversing the m4a tag above the ogg one. But no solution.

The error is like this on firefox

The buffer passed to decodeAudioData contains an unknown content type.

[lime.utils.AssetLibrary] WARNING: Could not load “assets/audios/gem-ping.m4a”

It works when I remove the m4a tag though. But then some safari and ios devices complain for not finding the desired audio format ( m4a)

Could this be a howler.js issue?

No idea. May be I should check using howlerjs separately.

I am guessing that we provide Howler.js with all of the available media types, and that it is attempting to pick the M4A before a compatible type (perhaps due to the order in which we provide it to the library, or perhaps it has a preference?) and the browser is complaining. I would think that Howler would be the best place to check if the audio type is compatible with the browser and exclude it, though perhaps on our end this could be resolved either by a user agent check or by using a different file order to put OGG or MP3 before M4A, though perhaps there would not be a benefit of having M4A at all if the others were always prioritized?

Something wrong with the m4a file. I used another online mp3 to m4a converter and it worked.
The browser was taking mp3 file. But could not process audio of any format, because of problem with loading m4a file.

Ideally it should have not tried to process m4a file if it was anyhow going to use the mp3 one.

1 Like