how i could correctly Register a listener for icecandidate events on the RTCPeerConnection?

18 views
Skip to first unread message

Ahmed Karam

unread,
Nov 26, 2022, 7:59:14 AM11/26/22
to discuss-webrtc
in my app i have 2 connection like so 
yourConn1 = new RTCPeerConnection(servers);
yourConn2 = new RTCPeerConnection(servers);
in here  Instructure
https://webrtc.org/getting-started/peer-connections-advanced
they said in number 5 and 6 and 7 
 
Register a listener for icecandidate events on the RTCPeerConnection

For each icecandidate events, transfer it (using a signalling service) to the remote peer

Wait for incoming remote ICE candidates from the signalling service and add them using
RTCPeerConnection.addIceCandidate()
as a caller
 


and as a callee the last three steps also same thing 

Register a listener for icecandidate events on the RTCPeerConnection

For each icecandidate events, transfer it (using a signalling service) to the remote peer

Wait for incoming remote ICE candidates from the signalling service and add them using
RTCPeerConnection.addIceCandidate()

should i listen to each new RTCPeerConnection(x) if i had 2 of them  like so 
p1.onicecandidate = (event) => { }; p2.onicecandidate = (event) => { };

and as a caller sould i add ice candidate for my connection not for the calle or should to add candidate for both of them like so 

var NewlyIceCandidate = new RTCIceCandidate(candidate);
    await p1.addIceCandidate(NewlyIceCandidate);
 
Reply all
Reply to author
Forward
0 new messages