为什么localStreams包含LocalMediaStream,remoteStreams包含MediaStream?

时间:2012-07-18 10:51:36

标签: webrtc

enter image description here

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

但是, remoteStreams 包含“ MediaStream ”对象

为什么如此差异?

当我使用“ localStreams ”时 - 它对我有用:

localVideo.src = URL.createObjectURL(localStreams[0]);

但如果我尝试使用“ remoteStreams ” - 它不起作用:

remoteVideo.src = URL.createObjectURL(remoteStreams[0])
remoteStreams ”和“ localStreams ”的

Blob 在样式上看起来相同。

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

remoteVideo.src = URL.createObjectURL(secondPeer.remoteStreams[0])
"blob:http%3A//localhost%3A8082/78e8821f-90b8-4703-b56d-918ec505e5bf"

现场演示:--- https://muazkh.appspot.com/?page=WebRTC

1 个答案:

答案 0 :(得分:0)

LocalMediaStream正在被MediaStream接口取代。

simpl.info/pc上,请在Chrome稳定版和Canary中的控制台中尝试此操作:

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