Record in a different codec when Firefox is detected - Javascript
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Currently, the code of this page doesn't seem to work on Firefox 75:

It produces the following error when trying to record and playback:
video/webm;codecs=vp9 is not Supported

Link to source
Link to relevant section in main.js

I'm looking for code that would switch the recording and playback codec to vp8 if Firefox is detected. (Or any other solution you can think of that will make it work on Firefox, while preserving recording in vp9 for other browsers)

Crowdsource coding tasks.

1 Solution


Line 81, you are missing opus audio format:
options = { mimeType: 'video/webm;codecs=opus,vp8' };

Tested and works on Firefox 75 :)


As I bonus I've refactored the ugly nested if statement which is prone to errors and not scalable

Here is the code for that:

Thanks! Good solution to make it more scalable, thank you!
Jay 24 days ago
You're welcome! Thank you :)
VladimirMikulic 24 days ago