Skip to content

Commit

Permalink
Merge pull request #8 from upsuper/patch-1
Browse files Browse the repository at this point in the history
Bypass naive WebRTC blocking
  • Loading branch information
diafygi committed Feb 5, 2015
2 parents 9980227 + 5a40e21 commit d9da4fd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ <h4>Your public IP addresses:</h4>
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;
RTCPeerConnection = window.RTCPeerConnection
|| window.mozRTCPeerConnection
|| window.webkitRTCPeerConnection;
}
var mediaConstraints = {
optional: [{RtpDataChannels: true}]
};
Expand Down

0 comments on commit d9da4fd

Please sign in to comment.