Chromium sends the null icecandidate just because there isn't a onicegatheringcomplete event handler. And as far as I understand it sometimes we don't know that a icecandidate is the last one which makes your first suggestion unimplementable. On Mon, Apr 22, 2013 at 2:43 PM, Adam Bergkvist <adam.bergkvist@ericsson.com > wrote: > 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 14:26:33 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:17:42 UTC