Thursday 10 December 2020

How to get mp4's codec mime information?

How can I get a MP4's codec information in JavaScript so that I can check if the browser supports it?

const audioCodec = '';//<---?? exmaple: "mp4a.40.2"
const videoCodec = '';//<---?? example: "avc1.42e01e"
const video = document.getElementById('video');
const mimeCodec = 'video/mp4; codecs="' + audioCodec + ', ' + videoCodec + '"';

if (!('MediaSource' in window) || !MediaSource.isTypeSupported(mimeCodec)) {
    console.error('Unsupported MIME type or codec: ', mimeCodec);
}



from How to get mp4's codec mime information?

No comments:

Post a Comment