我正在尝试使用apiRTC进行视频会议。 我将保存并重用远程用户流,以便当用户单击迷你视频以在远程部分中查看时可以附加它们。 我试图在MCUAvailableStreamHandler中获取并保存流。 请看下面。
var joinInfo = {};
function MCUAvailableStreamHandler(e){
console.log("---------MCUAvailableStreamHandler-----:");
if (e.detail.isRemoteStream) {
//This a remote stream list, subscribing to remote streams
console.log("Remote streams available");console.log(e.detail.stream);
webRTCClient.subscribe(e.detail.streams);
var streams = e.detail.streams;
streams.forEach(function(stream , i){
remoteId = stream.attributes.callerId;
var remoteInfo = {};
remoteInfo['stream_id'] = stream.id;
remoteInfo['callType'] = stream.attributes.callType;
remoteInfo['screen'] = stream.screen;
remoteInfo['video'] = stream.video;
if (joinInfo[remoteId] == undefined )
joinInfo[remoteId] = remoteInfo;
if (joinInfo.length == 1) {
hangout.currentRemoteId = remoteId;
hangout.selectRemote(remoteId);
}
});
} else {
//This my own stream, not subscribing to it
console.log("my own stream is available on MCU");console.log(e.detail.stream);
}
}
然后单击mini remote时,我会这样编码。
function selectRemote(remoteId){
var stream = webRTCClient.getStreamFromList(joinInfo[remoteId]['stream_id']);
addStreamInDiv(stream , 'media' , 'remote' , 'remoteElt-'+remoteId , false , remoteId);
}
但是我遇到了以下错误。
未捕获的TypeError:无法在上设置'srcObject'属性 'HTMLMediaElement':提供的值不是'MediaStream'类型的。
我想知道将流保存在哪里,以便在需要时可以获取“ MediaStream”。 任何帮助将不胜感激。 谢谢 。最好的问候。