I am developing the signaling system between two peers and have noticed that the RTCPeerConnection.onicecandidate event is not firing. I checked the iceGatheringState and it always returns as "new" meaning the peer connection has not began searching for ice candidates.
How do I initiate the gathering of ice candidate objects from the local machine to be sent out to a peer?
and
If I do not want to trickle candidates, how will I be able to send them over sdp once gathered?
This is my current code, I am able to successfully attain sdp data and capture them to be sent so ice and checking if the two clients are connected are the only issues.
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);
///Event Handlers//
//will be called when each event occurs
//onicecandidate
//returns local ice candidates (when gathered) to be sent to peer
//peerConn.onicecandidate = onicecandidate;
peerConn.onicecandidate = function(iceEvent){ //not firing
if(iceEvent.candidate === null){
alert(peerConn.iceConnectionState);
alert(iceEvent.candidate);
//send to peer or put in with sdp data
}
}