From cf559b599cea684b8bb80ac59dcdb7879265120b Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Mon, 2 Feb 2015 09:42:37 +1100 Subject: [PATCH 1/2] Bypass naive WebRTC blocking. --- index.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.html b/index.html index e3f436a..22ae94d 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,19 @@ var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || 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; + var RTCPeerConnection = window.RTCPeerConnection + || window.mozRTCPeerConnection + || window.webkitRTCPeerConnection; + } var mediaConstraints = { optional: [{RtpDataChannels: true}] }; From 5a40e215e927f53c8fd96d530108cd2be61f705a Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 4 Feb 2015 09:51:29 +1100 Subject: [PATCH 2/2] Remove unnecessary 'var'. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 22ae94d..66e5bb1 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@ window.RTCPeerConnection = win.RTCPeerConnection; window.mozRTCPeerConnection = win.mozRTCPeerConnection; window.webkitRTCPeerConnection = win.webkitRTCPeerConnection; - var RTCPeerConnection = window.RTCPeerConnection + RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; }