Closed yocontra closed 9 years ago
In terms of iosRTC, they can't provide the globals until the "deviceready" event is emitted. This module detects the globals when it's initially required, so you might have a timing issue.
+1 for supporting unprefixed modules, though.
@RangerMauve Sure, but that isn't of any concern to this module or any other one.
document.addEventListener('deviceready', function(){
var rtc = require('webrtcsupport');
// do your stuff
});
and for temasys it would be
var adapter = require('adapterjs');
adapter.webRTCReady(function(){
var rtc = require('webrtcsupport');
// do your stuff
});
Want a web app that can use WebRTC in any browser, node, and any mobile device?
// quick pseudo-code
function getRTC(cb){
// nodejs
if (typeof document === 'undefined') {
cb(require('wrtc'));
}
// ios via cordova
if (window.device && window.device.platform === 'iOS') {
document.addEventListener('deviceready', function(){
cordova.plugins.iosrtc.registerGlobals();
cb(require('webrtcsupport'));
});
}
// all desktop browsers + android
require('adapterjs').webRTCReady(function(){
cb(require('webrtcsupport'));
});
}
getRTC(function(webrtc){
// congrats, do your stuff
});
Too bad webrtcsupport (and the whole ecosystem of modules that rely on it) are stuck on chrome/firefox only because they want to neglect this simple fix 😱
I agree fully.
Your concern is that this module doesn't do
var PC = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
?
Interested how you're getting this to work in Microsoft Edge (since you said 'any browser)
My hope is that edge will hurry up with their ORTC crap so that someone can polyfill WebRTC on top of it.
@fippo temasys is going to handle edge in the future https://github.com/Temasys/AdapterJS/issues/99
Also yes, the issue was that simple and easy to fix, which is why I was so confused about why it was open for so long and such a problem to fix.
I think there still might be some problems with the way the browser detection is done (since it assumes if webkitPeerConnection exists then it is chrome, even though webkitPeerConnection can also exist on safari/ie via temasys) but I will open further tickets as needed. Thank you for fixing this.
My take on the version/prefix part of this library is that it's not 100% needed.
I have gradually gotten rid of this library actually in favor of adapter. But things take time.
there are plenty of vendors in the wild without prefixes (iosrtc) so why does this not work with those?