forked from mozilla/webrtc-landing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stun_test_ip.html
45 lines (34 loc) · 1.02 KB
/
stun_test_ip.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title> RTCPeerConnection STUN Gathering Test</title>
</head>
<body>
<h1> RTCPeerConnection STUN Gathering Test</h1>
<div id="log"></div>
<script type="application/javascript">
function log(msg) {
let div = document.getElementById("log");
div.innerHTML = div.innerHTML + "<p>" + msg + "</p>";
}
let pc1;
function failed(code) {
log("Failure callback: " + JSON.stringify(code));
}
var configuration = { "iceServers": [{ "url": "stun:173.194.78.127:19302" }]};
pc1 = new RTCPeerConnection(configuration);
pc1.onicecandidate = function(c) {
log("ICE candidate: " + JSON.stringify(c));
}
navigator.mozGetUserMedia({video:true, fake:true},
function(stream) {
pc1.addStream(stream);
setTimeout(function() {
pc1.createOffer(function(offer) {
log("Created offer: " + offer.sdp.replace(/[\n]/g, '<br>'));
},
failed
);
}, 5000);
},
failed);
</script>