rtc.on('ready') fires too soon
mudcube opened this issue · 3 comments
I was running into an issue where rtc.on('ready') fires too soon about half the time... I think it has something to do with me setting up an HTTPS server on my localhost, and then authorizing the video to always work onload... so now perhaps things are authorized in an order not expected by WebRTC.io.
I ended up doing some debugging, and found that by modifying the get_peers listener to function more like the "ready" listener, the connection works every time:
rtc.on('get_peers', function(data) {
rtc.connections = data.connections;
rtc._me = data.you;
//-
rtc.createPeerConnections();
rtc.addStreams();
rtc.addDataChannels();
rtc.sendOffers();
// fire connections event and pass peers
rtc.fire('connections', rtc.connections);
});
Its looks good. What about doing a pull request?
Just sent you a pull request. Thanks for putting this together btw, it's saving me a lot of time! I'm excited about the technology, and am behind you with the WebRTC.io simplification of the APIs. I'm putting WebRTC.io to use in a demo for the upcoming Google IO conference :)
Cool! let me see the demo when its done and the talk if its recorded.