Stop Webcam recording by file size

CodeSandBox (Live Code):

How can I make the Webcam stop recording (stopRecording() function) when, while recording, it detects that it has reached a limit of 1 MegaByte or 1 minute?’

I been trying with:

    // converts bytes to megabytes
    const maxFileSize = ((streamRef.current.size/1024)/1024).toFixed(4)
    if(maxFileSize >= 1) {
      // OR

but it wasn’t sucessful

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.