[ortc] Regarding queued candidate events

ibc has just created a new issue for https://github.com/openpeer/ortc:

== Regarding queued candidate events ==
> Since ICE candidate gathering begins once an RTCIceGatherer object 
is created, candidate events are queued until an onlocalcandidate 
event handler is assigned.

So what would happen in this case?:

```js
var gatherer = new RTCIceGatherer();

// Gathering begins

setTimeout(function() {
  // First "localcandidate" event listener
  gatherer.addEventListener('localcandidate', function(event) {
    console.log("Sure this is printed: ", event.candidate);
  });

  // Second "localcandidate" event listener
  gatherer.addEventListener('localcandidate', function(event) {
    console.log("Is this also printed?: ", event.candidate);
  });
}, 5000);
```

Would the second listener be triggered for the first buffered 
`RTCIceCandidate`?

iMHO this is unclear and may be a little "hack". What I would expect 
is that, once a `RTCIceGatherer` is created, the user app must be 
ready to handle "localcandidate" events within the next JS iteration, 
so:

```js
var gatherer = new RTCIceGatherer();

gatherer.addEventListener('localcandidate', function(event) {
  // This is called for every gathered candidate.
});

gatherer.addEventListener('localcandidate', function(event) {
  // This is called for every gathered candidate.
});

setTimeout(function() {
  gatherer.addEventListener('localcandidate', function(event) {
    // This may not be called for the first candidates (user app bug)
  });
}, 0);
```

Please view or discuss this issue at 
https://github.com/openpeer/ortc/issues/311 using your GitHub account

Received on Saturday, 26 December 2015 13:59:03 UTC