Video streaming RecordRTC |我们可以在不停止记录的情况下保存blob数据吗

Video streaming RecordRTC |我们可以在不停止记录的情况下保存blob数据吗,video-streaming,html5-video,video-capture,recordrtc,Video Streaming,Html5 Video,Video Capture,Recordrtc,我正在使用RecordRTC并尝试每1分钟保存一次视频,但为了保存视频,我必须调用stopRecording()。 例如: function postFiles() { var blob = recorder.getBlob(); // getting unique identifier for the file name var fileName = generateRandomString() + '.webm';

我正在使用RecordRTC并尝试每1分钟保存一次视频,但为了保存视频,我必须调用stopRecording()。 例如:

function postFiles() {
            var blob = recorder.getBlob();
            // getting unique identifier for the file name
            var fileName = generateRandomString() + '.webm';

            var file = new File([blob], fileName, {
                type: 'video/webm'
            });

            xhr('/uploadFile', file, function(responseText) {
                    console.log(responseText);
            });

            if(mediaStream) mediaStream.stop();
        }

stopRecording(postFiles);
我想在不停止录制的情况下保存视频。

相关演示:

如您所见,我传递了两个附加参数:

  • ondataavailable
    回调函数
  • 时间片
    间隔

  • ondataavailable
    将在每个指定间隔后返回blob。

    我将通过套接字将其发送到node js服务器。我正在那里发送“blob”,并在节点js上接收缓冲区。。。我如何才能从服务器上获得socket.broadcast.emit(),以便有人可以观看直播流?我应该如何对其进行编码/解码?@Muaz Khan尝试了相同的方法,但第一个视频块保存正确,其余的块保存不正确。他们甚至根本不玩。有什么解决办法吗?任何人都可以帮我。
    recorder = RecordRTC(camera, {
        recorderType: MediaStreamRecorder,
        mimeType: 'video/webm',
        timeSlice: 1000, // pass this parameter
        ondataavailable: function(blob) {
            invokeSaveAsDialog(blob);
        }
    });