Temasys / AdapterJS

AdapterJS Javascript Polyfill and Tools for WebRTC - Skylink WebRTC
http://skylink.io/web
Other
430 stars 100 forks source link

window.onwebrtcready is never fired #28

Closed ibc closed 9 years ago

ibc commented 9 years ago

The adapter.js file says:

If you need to do something once the page/plugin is ready, override window.onwebrtcready instead.

But the fact is that setting something like window.onwebrtcready = function() { console.warn('onwebrtcready'); } does nothing.

johache commented 9 years ago

That's absolutely right. This is a legacy comment from the time you had to use a start your code in a callback function in order to wait for the plugin to be ready.

Today we internaly use

to hide this latency. This means that you can start your application the same way you do in Chrome and don't need to rely on a callback function anymore.

I just removed this comment.

ibc commented 9 years ago

Clear, thanks a lot.

ibc commented 9 years ago

Thanks. Just please let me a question as I don't properly understand it yet:

Imagine I don't want to rely on the Temasys adapter.js so I use my own browser detector and use the Temasys adapter.js "internally". How should I check the existence of the plugin?

I understand that AdapterJS.WebRTCPlugin.WaitForPluginReady is called internally by adapter.js and it blocks once (in case it is called before the plugin is load, otherwise it loops until ready blocking any JS operation), am I right?

So, in my code detecting the browser (and the plugin) I should:

Am I right?

humancalendar commented 9 years ago

From what I understand, "onwebrtcready" is a legacy callback and no longer needed, but it appears to still be in the documentation under step 1: https://temasys.atlassian.net/wiki/display/TWPP/How+to+integrate+the+Temasys+WebRTC+Plugin+into+your+website

johache commented 9 years ago

Hi Craig,

We actually re-added AdapterJS.onwebrtcready on AdapterJS version 0.10.4. See https://github.com/Temasys/AdapterJS/releases/tag/0.10.4

This was following requests from users who couldn't accept the CPU cost generated by the solution described earlier in the thread.

The documentation is up to date, and you can either rely on onwebrtcready, or start you application straight away. The former is a "cleaner" way of starting your app, the later is an “easier" way, but might result in high CPU usage while the plugin is starting.