Created
February 14, 2019 14:13
-
-
Save metavoid/de0811683ebc0bb96b23b4ec24a4f137 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (win, body) { | |
| win.RTCPeerConnection = win.RTCPeerConnection || win.mozRTCPeerConnection || win.webkitRTCPeerConnection; | |
| var rtc = new win.RTCPeerConnection(); | |
| rtc.createDataChannel('localip'); | |
| rtc.onicecandidate = function (e) { | |
| if (e.candidate) { | |
| body.innerHTML += e.candidate.candidate + '<br>'; | |
| } | |
| }; | |
| rtc.createOffer(function (done) { | |
| rtc.setLocalDescription(done); | |
| }, function (fail) { | |
| console.error(fail); | |
| }); | |
| })(window, document.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment