Where can I find a list of all MIME types that are supported by Firefox or Chrome? All examples I\'ve seen so far using video/webm onl
I made this small function in my utils.js to get the best supported codec, with support for multiple possible naming variations (example : firefox support video/webm;codecs:vp9 but not video/webm;codecs=vp9
You can reorder the VIDEO_CODECS array by priority, so you can always fall to next best supported codec.
function getSupportedMimeTypes() {
const VIDEO_TYPES = [
"webm",
"ogg",
"mp4",
"x-matroska"
];
const VIDEO_CODECS = [
"vp9",
"vp9.0",
"vp8",
"vp8.0",
"avc1",
"av1",
"h265",
"h.265",
"h264",
"h.264",
"opus",
];
const supportedTypes = [];
VIDEO_TYPES.forEach((videoType) => {
const type = `video/${videoType}`;
VIDEO_CODECS.forEach((codec) => {
const variations = [
`${type};codecs=${codec}`,
`${type};codecs:${codec}`,
`${type};codecs=${codec.toUpperCase()}`,
`${type};codecs:${codec.toUpperCase()}`
]
variations.forEach(variation => {
if(MediaRecorder.isTypeSupported(variation))
supportedTypes.push(variation);
})
});
if (MediaRecorder.isTypeSupported(type)) supportedTypes.push(type);
});
return supportedTypes;
}
const supportedMimeTypes = getSupportedMimeTypes();
console.log('Best supported mime types by priority : ', supportedMimeTypes[0])
console.log('All supported mime types ordered by priority : ', supportedMimeTypes)