Search code examples
htmlfirefoxvideomedia-source

MediaSource.addSourceBuffer fails with video/ogg and video/webm


I've gotten some MediaSource code working on my XP/FF50 machine that creates a MediaSource and adds a SourceBuffer. On the XP machine, both of these codecs work:

'video/webm; codecs="vp8, vorbis"'
'video/ogg; codecs="theora, vorbis"'

When I bring the code over to my Win10/FF50 machine, both of these codecs throw these similar errors:

Cannot play media. No decoders for requested formats: video/ogg; codecs="theora vorbis"
Cannot play media. No decoders for requested formats: video/webm; codecs="vp8 vorbis"

My ogg and a webm files play correctly on the Win10 machine when setting the video's src attribute.

I've checked the following:

console.log(MediaSource.isTypeSupported('video/mp4')); <--returns true
console.log(MediaSource.isTypeSupported('video/ogg')); <--returns false
console.log(MediaSource.isTypeSupported('video/webm')); <--returns false
var videoElement = document.createElement('video');
console.log(videoElement.canPlayType('video/mp4; codecs="avc1.42001E, mp4a.40.2"')); <--returns probably
console.log(videoElement.canPlayType('video/webm; codecs="vp8, vorbis"')) <--returns probably
console.log(videoElement.canPlayType('video/ogg; codecs="theora, vorbis"')) <--returns probably

Any idea what I missed?


Solution

  • In Firefox's about:config, change media.mediasource.webm.enabled to true.