您知道问题可能在哪里吗? localVideo元素可以正常工作,但是我在两台计算机上获得的remoteVideo元素都是(无限循环/加载),带有...
2 = NETWORK_LOADING - browser is downloading data
0 = HAVE_NOTHING - no information whether or not the audio/video is ready
✔️每个对等连接(pc)都具有来自其他对等方的要约或应答的正确 remoteSDP 。
✔️ remoteVideo元素具有。 。
Autoplay == true
Muted == false
Paused == false
Disabled == false
✔️ ICE 似乎可以解决,因为每台PC都有。 。
iceConnectionState: "new"
iceGatheringState: "complete"
✔️我的代码中的最后一个命令是。 。
remoteVideoElement.srcObject = e.streams[0];
(由先前声明的pc1.addEventListener('track', gotRemoteStream);
触发)✔️当我打开控制台并尝试手动将PC的remoteStream附加到视频元素时,什么也没有发生,如下所示:
remoteVideo.srcObject = pc1.getRemoteStreams()[0];
以下是我的两个console.log()
组合:
要约人的活动在⏪左侧;回答者的活动在右侧⏩。 @Answerer
表示邮件正在发送 TO 应答者。
Offerer(pc1) . . . . . . . . . . . . Answerer(pc2)
``````````````````````````````````````````````````
Requesting local stream
Received local stream
Created local peer connection object pc1
Added local stream to pc1
pc1 createOffer start
-----------------2-----------------Offer, then SDP
2_____PC1_signalingState_____ stable
setLocalDescription complete
2.5_____PC1_signalingState_____ have-local-offer
--3--------------------------------
onOfferSendItToOtherPc()
. . . . . . . . . . . . . . . . . . message: @Answerer SDP-Offer:{"type":"offer","sdp":"v=0\r\no=- 1919269707352669653 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS 2qzHy5PolwyGALtwc39fuVJT4aGMaOdSJP8d......"}
-------------------------------4---
. . . . . . . . . . . . . . . . . . Requesting local stream
. . . . . . . . . . . . . . . . . . message: @Answerer ICE-Cand
. . . . . . . . . . . . . . . . . . message: @Answerer ICE-Cand
. . . . . . . . . . . . . . . . . . message: @Answerer ICE-Cand
. . . . . . . . . . . . . . . . . . message: @Answerer ICE-Cand
. . . . . . . . . . . . . . . . . . message: @Answerer ICE-Cand:null
. . . . . . . . . . . . . . . . . . Received local stream
. . . . . . . . . . . . . . . . . . Created local peer connection object pc2
. . . . . . . . . . . . . . . . . . Added local stream to pc2
❌PROBLEM HERE? (NO ANSWER YET!). . received remote stream
. . . . . . . . . . . . . . . . . . setRemoteDescription complete
. . . . . . . . . . . . . . . . . . 4.5_____PC2_signalingState_____ have-remote-offer
----------------------------5------
. . . . . . . . . . . . . . . . . . setLocalDescription complete
--------------------------------6--
. . .❗ ANSWER SENT HERE! . . . . . onAnswerSendItToOtherPc()
message: @Offerer SDP-Answer:{"type":"answer","sdp":"v=0\r\no=- 4846855406168784799 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS w2GnbUcp9SIA2ItZwAf9BIH9gBppgNJh4zju......"}
message: @Offerer ICE-Cand
pc1 received remote stream
setRemoteDescription complete
7. Answerer ==================== setRemoteDescription =======================
message: @Offerer ICE-Cand
message: @Offerer ICE-Cand:null
答案 0 :(得分:2)
ICE似乎可以解决问题,因为每台PC都有。 。
iceConnectionState: "new"
如果iceConnectionState仍然是新的,则ICE不能正常工作。
它仍然是新的,甚至没有检查表明没有远程候选冰添加到连接中。 This blog post解释了使用chrome:// webrtc-internals找出原因的方法。