Closed alexandrevicenzi closed 6 years ago
Thanks for heads-up. Need to implement this...
Maybe I'm oversimplifying things, but wouldn't it be easy to fix this by aliasing the vendor prefixed constructors like this?
function createRTCPeerConnection(config) {
if ('RTCPeerConnection' in window) {
return new RTCPeerConnection(config)
} else if ('webkitRTCPeerConnection' in window) {
return new webkitRTCPeerConnection(config)
} else if ('mozRTCPeerConnection' in window) {
return new mozRTCPeerConnection(config)
} else {
throw new Error('Browser is not supported');
}
}
function createRTCIceCandidate(candidate) {
if ('RTCIceCandidate' in window) {
return new RTCPeerConnection(candidate);
} else if ('webkitRTCIceCandidate' in window) {
return new webkitRTCPeerConnection(candidate);
} else if ('mozRTCIceCandidate' in window) {
return new mozRTCPeerConnection(candidate);
} else {
throw new Error('Browser is not supported');
}
}
Yeah — it's pretty straightforward :).
Actually the best/right way to do this is probably github.com/webrtc/adapter .
On 20 January 2017 at 18:30, A. M. Douglas notifications@github.com wrote:
Maybe I'm simplifying things, but wouldn't it be simple to simply alias the vendor prefixed constructors like this?
function createRTCPeerConnection(config) { if ('RTCPeerConnection' in window) { return new RTCPeerConnection(config)
} else if ('webkitRTCPeerConnection' in window) { return new webkitRTCPeerConnection(config)
} else if ('mozRTCPeerConnection' in window) { return new mozRTCPeerConnection(config)
} else { throw new Error('Browser is not supported'); } }
function createRTCIceCandidate(candidate) { if ('RTCIceCandidate' in window) { return new RTCPeerConnection(candidate);
} else if ('webkitRTCIceCandidate' in window) { return new webkitRTCPeerConnection(candidate);
} else if ('mozRTCIceCandidate' in window) { return new mozRTCPeerConnection(candidate);
} else { throw new Error('Browser is not supported'); } }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/samdutton/simpl/issues/50#issuecomment-274144351, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMhqn-c2dunHCmyhhKP7xe16I0sFQ_vks5rUP0ugaJpZM4Cv8gz .
@wnda I am looking to use this clear key code for video, but as stated above, it does not work on firefox, or IE. Any examples of the code out there for it to work on all the major browsers? This seems to only work on chrome.
@wnda @samdutton From where would I call the functions (createRTCPeerConnection and createRTCIceCandidate)? Would you guys mind making a basic example?
I'd really appreciate it!
Runnin on Firefox when I press start I get:
ReferenceError: webkitRTCPeerConnection is not defined