Skip to content

mimeType and recorderType

Muaz Khan edited this page Jan 17, 2019 · 1 revision
let mimeType = 'video/x-matroska;codecs=avc1'; // MKV
let recorderType = MediaStreamRecorder;

if (isMimeTypeSupported(mimeType) === false) {
    console.log(mimeType, 'is not supported.');
    mimeType = 'video/webm\;codecs=h264'; // H264

    if (isMimeTypeSupported(mimeType) === false) {
        console.log(mimeType, 'is not supported.');
        mimeType = 'video/webm\;codecs=vp9'; // VP9

        if (isMimeTypeSupported(mimeType) === false) {
            console.log(mimeType, 'is not supported.');
            mimeType = 'video/webm\;codecs=vp8'; // VP8

            if (isMimeTypeSupported(mimeType) === false) {
                console.log(mimeType, 'is not supported.');
                mimeType = 'video/webm'; // do NOT pass any codecs (vp8 by default)

                if (isMimeTypeSupported(mimeType) === false) {
                    console.log(mimeType, 'is not supported.');

                    // fallback to Whammy (WebP+WebM) solution
                    mimeType = 'video/webm';
                    recorderType = WhammyRecorder;
                }
            }
        }
    }
}

let recorder = RecordRTC(mediaStream, {
    mimeType: mimeType,
    recorderType: recorderType
});
Clone this wiki locally