W3C home > Mailing lists > Public > public-ortc@w3.org > December 2015

[ortc] Regarding queued candidate events

From: Iñaki Baz Castillo via GitHub <sysbot+gh@w3.org>
Date: Sat, 26 Dec 2015 13:59:01 +0000
To: public-ortc@w3.org
Message-ID: <issues.opened-123930709-1451138340-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:39:57 UTC