RecordRTC icon indicating copy to clipboard operation
RecordRTC copied to clipboard

When I recorded large Video, Web Application Crashed

Open vgokul129 opened this issue 5 years ago • 8 comments

I have the following source code to record Video stream(Video constraints: width: 1920, height: 1080, frameRate: 60).

function startRecord(){
        recorder = RecordRTC(window.stream, {
            type: 'video',
            mimeType: 'video/webm;codecs=vp8',
            recorderType: MediaStreamRecorder,
        });

        recorder.startRecording();
}

function stopRecord(){
  recorder.stopRecording(function() {
     var blob = recorder.getBlob();
        getSeekableBlob(blob, function(seekableBlob){
        var fileName = 'video.webm';
        var file = new File([seekableBlob], fileName, {
            type: 'video/webm'
        });

         invokeSaveAsDialog(file);
            });

    });
}

When I try to record video for long time (Say 1/2 an hour) video my application crashed in a while after invoking stopRecording() method.

Note: For small Video records its working well.

Platform: Chromebook OS Version: 73.0.3683.88 (Official Build)

I found an exact similar issue when tried with MediaStream API. When the same code works good in Linux and Windows Chrome Browsers.

vgokul129 avatar Apr 22 '19 14:04 vgokul129

@muaz-khan : Please look into this issue. I am struck with this so long. Any idea ?

vgokul129 avatar Apr 24 '19 07:04 vgokul129

I've encounted the same problem and here is my solution:

  • Increase maximum recording interval according to https://github.com/muaz-khan/RecordRTC/issues/144#issuecomment-283946767, default is 1 hour

  • Set timeSlice in configuration and get intervals based blobs via ondataavailable callback function

  • Use https://github.com/jimmywarting/StreamSaver.js to create a writable stream directly to the file system and save these blobs

Hope this helps

flyfly6 avatar May 11 '19 11:05 flyfly6

@flyfly6 Is it possible to show some example on how to increase the maximum recording interval? I have cases that the user can record videos for about 3 hours+. Which size is great to put and how? Thanks!

vctormb avatar May 16 '19 20:05 vctormb

@flyfly6 using timeslice and ondataavailable does not prevent the data to be stored inside local variable arrayOfBlobs. You just get them So in fact you should still have memory problems.

tonai avatar May 24 '22 15:05 tonai

@muaz-khan Is there any way to empty the local arrayOfBlobs after each ondataavailable event?

gnidustotalus avatar Feb 16 '24 11:02 gnidustotalus

There is an opened PR to fix this issue but not sure this repository is still very active.

tonai avatar Feb 16 '24 11:02 tonai

image

The last commit was yesterday.

gnidustotalus avatar Feb 16 '24 13:02 gnidustotalus

Yes after 2 years of inactivity

tonai avatar Feb 16 '24 13:02 tonai