Skip to content Skip to sidebar Skip to footer

Mp3 Support On Firefox Mediasourceextension

I'm looking into implementing adaptive and progressive audio streaming in the browser, with no plugins. MSE is the HTML5 API I was waiting for, available in FF 42, but it seems th

Solution 1:

OK, so I was able to figure it out with the kind help of Mozilla engineers working on Media Source Extension.

The first key thing to note on MSE (Media Source Extension) is that it does not necessarily support all media formats supported by the browser's Audio Element. To illustrate this, although Firefox will play mp3 file when fed directly to the browser or directly to an Audio element, it will not play the same mp3 file if you feed it into a media source buffer.

Now, which media format are actually supported by Firefox' MSE implementation? the answer is that as of Firefox 42 only fMP4 (Fragmented MP4) is supported by default. webm is also supported, but not by default and your users will have to turn it on manually through Firefox' about:config page. The fMP4 mimeType to feed the Media Source object when creating a new buffer is: audio/mp4; codecs="mp4a.40.2"

And if you're wondering what the heck is fMP4, it is a standard which is part of the MPEG-4 standard, more specifically part 12: "ISO Base Media File Format (ISOBMFF) using non-multiplexed audio/video". Look it up if you're interested in more details.

From my experience fMP4 is supported across all major browsers and OS - which makes fMP4 a good format candidate for adaptive and progressive streaming.

HTH!

Solution 2:

I use FF42 on linux, and, contrary to what I would believe reading the documentation on MDN, MediaSource API is not enabled by default.

Have you tried to go in about:config and tweaking the parameters dealing with the codecs supported by the MediaSource API? I have switches for MP4 and webm. Not sure it would help for MP3, but it may be worth giving it a try.

Solution 3:

i wrote something to encapsulate mp3 inside an mp4 on the fly in javascript, specifically to get this very thing working in firefox. i only needed it for an 128kbps stream, so this only works for that specific bitrate, with no album art. in case anyone else might find this useful: https://gist.github.com/fanfare/0fa525af28b275fd6623942d7e9d70dd

Post a Comment for "Mp3 Support On Firefox Mediasourceextension"