mp3 support on Firefox MediaSourceExtension

前端 未结 2 950
后悔当初
后悔当初 2021-01-18 01:37

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

相关标签:
2条回答
  • 2021-01-18 02:19

    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.

    0 讨论(0)
  • 2021-01-18 02:27

    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!

    0 讨论(0)
提交回复
热议问题