I am developing a signaling system between two peers and notice that the RTCPeerConnection.onicecandidate event does not fire. I checked iceGatheringState and it always returns as “new”, which means that the peer did not start looking for ice candidates.
How to initiate the collection of candidate objects on ice from the local machine, which will be sent to the peer?
and
If I do not want to leak candidates, how can I send them via sdp after they are assembled?
This is my current code, I can successfully get the sdp data and commit it for sending, so ice and checking if the two clients are connected are the only problems.
var peerConn = new webkitRTCPeerConnection(
{'iceServers':[{'url':'stun:stun.1.google.com:19302'}]}
);
var remoteConn = new webkitRTCPeerConnection(
{'iceServers':[{'url':'stun:stun.1.google.com:19302'}]}
);
alert(peerConn.iceGatheringState);
peerConn.onicecandidate = function(iceEvent){
if(iceEvent.candidate === null){
alert(peerConn.iceConnectionState);
alert(iceEvent.candidate);
}
}