Reputation: 147
Any idea where the problem might be? The localVideo element works fine, but all I get, in both computers, for the remoteVideo element, is this (endlessly circling/loading), with...
2 = NETWORK_LOADING - browser is downloading data
0 = HAVE_NOTHING - no information whether or not the audio/video is ready
✔️ Each Peer-Connection (pc) has the correct remoteSDP that came from the other Peer's Offer-or-Answer.
✔️ The remoteVideo element has . . .
Autoplay == true
Muted == false
Paused == false
Disabled == false
✔️ ICE seemed to work out, because each PC has . . .
iceConnectionState: "new"
iceGatheringState: "complete"
✔️ The last command in my code is . . .
remoteVideoElement.srcObject = e.streams[0];
(triggered by a previously-declared pc1.addEventListener('track', gotRemoteStream);
)✔️ Nothing happens when I open up the console, and try to manually attach the PC's remoteStream to the video element, like this:
remoteVideo.srcObject = pc1.getRemoteStreams()[0];
Here below are my two combined console.log()
s:
The Offerer's activity is on the ⏪left; the Answerer's activity is on the right⏩. @Answerer
means the message is being sent TO the Answerer.
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
Upvotes: 0
Views: 248
Reputation: 17265
ICE seemed to work out, because each PC has . . .
iceConnectionState: "new"
If iceConnectionState is still new then ICE did not work.
That it is still new and not even checking suggests no remote ice candidates have been added to the connection. This blog post explains the methodology of using chrome://webrtc-internals to figure out why that happens.
Upvotes: 2