muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.49k stars 1.75k forks source link

MediaRecorder API seems unable to record mimeType: video/webm #755

Open Thilanka-97 opened 3 years ago

Thilanka-97 commented 3 years ago

I'm using RecordRTC for audio and video recording. The issue is when I trying to record audio first then video. I'm getting this error. MediaRecorder API seems unable to record mimeType: video/webm. The Error didn't happen when doing the recording video first and after the audio recording.

Here is the Video Recorder code

const startRecord = () => {
    captureCamera(camera => {
        video.current.muted = true;
        video.current.volume = 0;
        video.current.srcObject = camera;
        const recordVideo = RecordRTC(camera, {
            type: 'video',
            mimeType: 'video/webm;codecs=vp9',
            recorderType: MediaStreamRecorder
        });
        recordVideo.camera = camera;

        setTimeout(() => {
            recordVideo.startRecording();
            setRecord(recordVideo);
        }, 500);
    });
};

const captureCamera = callback => {
    if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
        navigator.mediaDevices
            .getUserMedia({ audio: true, video: true })
            .then(camera => {
                callback(camera);
            })
            .catch(error => {
                console.log(error);
            });
    }
};

const stopRecord = () => {
    record.stopRecording(stopRecordingCallback);
};

const stopRecordingCallback = () => {
    getSeekableBlob(record.getBlob(), seekableBlob => {
        const blob = new Blob([seekableBlob], { type: 'video/x-matroska;codecs=avc1,opus' });
        const src = URL.createObjectURL(blob);
        console.log('File URL', src);
    });
    record.camera.stop();
    record.destroy();
    setRecord(null);
};

Console Report image

@muaz-khan , Kindly Request to consider this issue?

Karthikdb commented 3 years ago

I am having this same issue Did u find the solution??

hktalent commented 1 year ago

@Thilanka-97 @Karthikdb

,recorderType: !!navigator.mozGetUserMedia ? MediaStreamRecorder : WhammyRecorder

for me is ok