Below i have given the excerpt from this link about RTCPeerConnection.onicecandidate and wish to ask two question on the best of my understanding and need help if i got the concept correct or not . its bit complicated for me
The RTCPeerConnection.onicecandidate property is an EventHandler which specifies a function to be called when the icecandidate event occurs on an RTCPeerConnection instance. This happens whenever the local ICE agent needs to deliver a message to the other peer through the signaling server.
My interpretation with reference to below code
1.Does this means that RTCPeerconnection.onicecandidate automatically call the below Anonymous javascript function when it gets its Local Icecandidate with helps of ICE. And at the same time Anonymous function help to deliver a Ice candidate to remote Peer through signal SERVER.
2.With reference to below code : Does parameter event from event handler RTCPeerconnection.onicecandidate contain details about SDP info such as media type and codec and method candidate gives information from Ice candidate (ie ip address and port number). which further combine into sdp and passed to remote peer.
pc=new RTCPeerConnection();
pc.onicecandidate = function(event) {
if (event.candidate) {
// Send the candidate to the remote peer
} else {
// All ICE candidates have been sent
}
}