During establishing the video call ice candidates gathereing is started after the call to createOffer or createAnswer. I'd like to get all local ice candidates for the local peer before I call createOffer or createAnswer. This way I'll have all of them set in sdp description and there will be no need to send them separately to remote peer as they will go all together in sdp. Is it possible?
UPD: All I want is to gather Ice candidates and keep them. After I want to create offers and asnwers but without of waiting for gathering of candidates will fininsh. Also How to add Ice candidates to description manually? And Is it possible to disabale Ice candidates gathering without recreating RTCPeerConnection?
During establishing the video call ice candidates gathereing is started after the call to createOffer or createAnswer. I'd like to get all local ice candidates for the local peer before I call createOffer or createAnswer. This way I'll have all of them set in sdp description and there will be no need to send them separately to remote peer as they will go all together in sdp. Is it possible?
UPD: All I want is to gather Ice candidates and keep them. After I want to create offers and asnwers but without of waiting for gathering of candidates will fininsh. Also How to add Ice candidates to description manually? And Is it possible to disabale Ice candidates gathering without recreating RTCPeerConnection?
Share Improve this question edited Jun 7, 2015 at 11:21 Midnight Guest asked Jun 6, 2015 at 6:19 Midnight GuestMidnight Guest 1,8903 gold badges16 silver badges30 bronze badges3 Answers
Reset to default 8Candidate gathering only starts when you call setLocalDescription.
If you want an SDP with all the candidates, wait for the onicecandidate event without a candidate and inspect the peerconnection's localDescription.sdp which contains all candidates gathered so far.
You can reduce the delay by setting icecandidatepoolsize - then the browser will try and pre-gather candidates before Offer/Answer.
see: https://github./pipe/two/blob/master/index.html#L181
According to https://developer.mozilla/zh-CN/docs/Web/API/RTCPeerConnection/onicecandidate
When onicecandidate event in callback is null, issue that the peer connection has gather ice candidate plete. So at that time Create offer to other peer connection and the Offer's SDP info will contain 'a=candidate' attribute.
Reference: https://aggresss.github.io/webrtc-samples/src/content/peerconnection/pc1-mod/