Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webrtc 为什么localStreams包含LocalMediaStream而remoteStreams包含MediaStream?_Webrtc - Fatal编程技术网

Webrtc 为什么localStreams包含LocalMediaStream而remoteStreams包含MediaStream?

Webrtc 为什么localStreams包含LocalMediaStream而remoteStreams包含MediaStream?,webrtc,Webrtc,localStreams和remoteStreams都属于“MediaStreamList”类型。 localStreams包含“LocalMediaStream”对象 但是,remoteStreams包含“MediaStream”对象 为什么如此不同 当我使用“localStreams”时,它适用于我: localVideo.src = URL.createObjectURL(localStreams[0]); 但是,如果我尝试使用“远程流””——它不起作用: remoteVideo.src

localStreamsremoteStreams都属于“MediaStreamList”类型。 localStreams包含“LocalMediaStream”对象

但是,remoteStreams包含“MediaStream”对象

为什么如此不同

当我使用“localStreams”时,它适用于我:

localVideo.src = URL.createObjectURL(localStreams[0]);
但是,如果我尝试使用“远程流””——它不起作用:

remoteVideo.src = URL.createObjectURL(remoteStreams[0])
remoteStreams”和“localStreams”的blob在样式上看起来相同

为什么“remoteStreams”对我不起作用(在“onaddstream”事件中或直接)


现场演示:--

本地媒体流正在被媒体流接口所取代

在上,使用Chrome Stable和Canary从控制台尝试以下操作:

localPeerConnection.getLocalStreams()[0];
remotePeerConnection.getRemoteStreams()[0];

这意味着“远程流连接”是可能的,Sam,用于进一步转发?它总是失败。实验表明它仍然失败:-很抱歉提出了一个离题的问题。嗨,Sam和@MuazKhan,
getRemoteStreams
现在正在弃用,我们有变通方法吗?嗨@Xin-看看另一种方法(自己动手!)。同样在adapter.js:Hi@Xin中,您可以使用“peer.getReceivers()”。您将使用“receiver.track”属性获得两个MediaStreamTrack对象。现在,您可以使用“newmediastream([track1,track1])”或“stream.addTrack”合并这些曲目。非常感谢
localPeerConnection.getLocalStreams()[0];
remotePeerConnection.getRemoteStreams()[0];