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

Unable to get the (promise) demo to run; `Blob object is required` #770

Closed kalaschnik closed 2 years ago

kalaschnik commented 2 years ago

I am not able to get the demo from the README.md to run; is there anything I am doing wrong?

My Code:

import { RecordRTCPromisesHandler, invokeSaveAsDialog } from 'recordrtc';

let stream = await navigator.mediaDevices.getUserMedia({
  video: true,
  audio: true,
});
let recorder = new RecordRTCPromisesHandler(stream, {
  type: 'video',
});
recorder.startRecording();

const sleep = (m) => new Promise((r) => setTimeout(r, m));
await sleep(3000);

recorder.stopRecording();
let blob = await recorder.getBlob();
invokeSaveAsDialog(blob);

The last line is actually causing the error: Uncaught (in promise) Blob object is required.

kalaschnik commented 2 years ago

Nevermind, it is working now; I think there was some bad interplay with my virtual camera coming from OBS