Webrtc 使用带有RTCCulticonnection的RecordRTC开始录制不起作用

Webrtc 使用带有RTCCulticonnection的RecordRTC开始录制不起作用,webrtc,recordrtc,rtcmulticonnection,Webrtc,Recordrtc,Rtcmulticonnection,我正在尝试记录添加到RTCMultiConnection的每个新会话/用户 我正在应用程序中使用以下演示url 现在,我在代码中添加了以下cdn引用。 这就是我正在使用的代码,但是connection.streams[event.streamid].startRecording()不工作 /..RTC多连接代码。。。。。。。。。。。。。 // ...................................................... var connection=新的RTC

我正在尝试记录添加到RTCMultiConnection的每个新会话/用户
我正在应用程序中使用以下演示url

现在,我在代码中添加了以下cdn引用。

这就是我正在使用的代码,但是
connection.streams[event.streamid].startRecording()不工作

/..RTC多连接代码。。。。。。。。。。。。。
// ......................................................
var connection=新的RTCCulticonnection();
var btnStopRec=document.getElementById(“btnStopRecording”);
connection.socketURL=https://rtcmulticonnection.herokuapp.com:443/';
connection.enableFileSharing=true;
connection.session={
音频:是的,
视频:没错,
数据:没错,
};
connection.sdpConstraints.mandatory={
OfferToReceiveAudio:正确,
OfferToReceiveVideo:没错,
};
connection.onstream=函数(事件)
{
document.body.appendChild(event.mediaElement);
console.log(“流记录开始”)
connection.streams[event.streamid].startRecording();
console.log(“流记录已启动”)

}

我在下面的一个片段中列出了所有可能的情况。请仅获取您需要的代码:

// global object that contains multiple recorders
var recorders = {};

// auto start recorder as soon as stream starts/begins
connection.onstream = function(event) {
    document.body.appendChild(event.mediaElement);

    recorders[event.streamid] = RecordRTC(event.stream, {
        type: 'video'
    });

    recorders[event.streamid].startRecording();
};

// auto stop recorder as soon as stream stops/ends
connection.onstreamended = function(event) {
    if (recorders[event.streamid]) {
        recorders[event.streamid].stopRecording(function() {
            var blob = recorders[event.streamid].getBlob();
            var url = URL.createObjectURL(blob);
            window.open(url);

            delete recorders[streamid]; // clear
        });
    }

    if (event.mediaElement.parentNode) {
        event.mediaElement.parentNode.removeChild(event.mediaElement);
    }
};

// stop single recorder
document.getElementById('manually-stop-single-recording').onclick = function() {
    var streamid = prompt('Enter streamid');
    recorders[streamid].stopRecording(function() {
        var blob = recorders[streamid].getBlob();
        var url = URL.createObjectURL(blob);
        window.open(url);

        delete recorders[streamid]; // clear
    });
};

// stop all recorders
document.getElementById('manually-stop-all-recordings').onclick = function() {
    Object.keys(recorders).forEach(function(streamid) {
        recorders[streamid].stopRecording(function() {
            var blob = recorders[streamid].getBlob();
            var url = URL.createObjectURL(blob);
            window.open(url);

            delete recorders[streamid]; // clear
        });
    });
};

// record outside onstream event
// i.e. start recording anytime manually
document.getElementById('record-stream-outside-the-onstream-event').onclick = function() {
    var streamid = prompt('Enter streamid');
    var stream = connection.streamEvents[streamid].stream;

    recorders[streamid] = RecordRTC(stream, {
        type: 'video'
    });

    recorders[streamid].startRecording();
};