Merge pull request #8 from upsuper/patch-1
Bypass naive WebRTC blocking
This commit is contained in:
commit
d9da4fdb9c
1 changed files with 13 additions and 0 deletions
13
index.html
13
index.html
|
@ -28,6 +28,19 @@
|
||||||
var RTCPeerConnection = window.RTCPeerConnection
|
var RTCPeerConnection = window.RTCPeerConnection
|
||||||
|| window.mozRTCPeerConnection
|
|| window.mozRTCPeerConnection
|
||||||
|| window.webkitRTCPeerConnection;
|
|| window.webkitRTCPeerConnection;
|
||||||
|
if (!RTCPeerConnection) {
|
||||||
|
//bypass naive webrtc blocking
|
||||||
|
var iframe = document.createElement('iframe');
|
||||||
|
iframe.style.display = 'none';
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
var win = iframe.contentWindow;
|
||||||
|
window.RTCPeerConnection = win.RTCPeerConnection;
|
||||||
|
window.mozRTCPeerConnection = win.mozRTCPeerConnection;
|
||||||
|
window.webkitRTCPeerConnection = win.webkitRTCPeerConnection;
|
||||||
|
RTCPeerConnection = window.RTCPeerConnection
|
||||||
|
|| window.mozRTCPeerConnection
|
||||||
|
|| window.webkitRTCPeerConnection;
|
||||||
|
}
|
||||||
var mediaConstraints = {
|
var mediaConstraints = {
|
||||||
optional: [{RtpDataChannels: true}]
|
optional: [{RtpDataChannels: true}]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue