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.46k stars 1.75k forks source link

Type 'RecordRTCPromisesHandler' is missing the following properties from type 'RecordRTC': setRecordingDuration, save, toURL, initRecorder, and 10 more.ts(2740) #787

Open faizanmohiuddin482 opened 2 years ago

faizanmohiuddin482 commented 2 years ago

using "recordrtc": "^5.6.2",

const [recorder, setRecorder] = useState<RecordRTC | null>()

const startRecording = async () => {
    const mediaDevices = navigator.mediaDevices
    const stream: MediaStream =
      type === 'video'
        ? await mediaDevices.getUserMedia({
            video: true,
            audio: true,
          })
        : await (mediaDevices as any).getDisplayMedia({
            video: true,
            audio: false,
          })
    const recorder: RecordRTC = new RecordRTCPromisesHandler(stream, {
      type: 'video',
    })

    await recorder.startRecording()
    setRecorder(recorder)
    setStream(stream)
    setVideoUrlBlob(null)
  }