- From: Adam Bergkvist <adam.bergkvist@ericsson.com>
- Date: Mon, 22 Apr 2013 14:43:11 +0200
- To: "public-webrtc@w3.org" <public-webrtc@w3.org>
Hi
I got some offline feedback from a user of our API, regarding the way we
signal that the gathering process is done. The comment was: "Why do I
get an icecandidate event without a candidate? That's like a
mouse-click-event that says that the mouse wasn't clicked."
If we want to change this behavior, there are a bunch of alternatives.
Here are two:
One variant is to set the iceGatheringState to "complete" when the last
candidate is emitted. This approach is a bit dependent on if the UA can
figure out if this is the last candidate without delaying it (too much).
pc.onicecandidate = function (evt) {
dealWithCandidate(evt.candidate);
if (pc.iceGatheringState == "complete")
sendOfferOrAnswer();
};
An other option is to simply use separate events.
// separate events
pc.onicecandidate = function (evt) {
dealWithCandidate(evt.candidate);
};
pc.onicegatheringcomplete = function () {
sendOfferOrAnswer();
};
/Adam
Received on Monday, 22 April 2013 12:43:35 UTC