-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
63 lines (56 loc) · 1.91 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebRTC Privacy / Leak Checker</title>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="rtc-api.js"></script>
<style>
#user-media-status-reject,
#rtc-supported-reject {
color: red;
}
#user-media-status-accept,
#rtc-supported-accept {
color: green;
}
</style>
</head>
<body>
<div id="user-media-status-reject"></div>
<div id="user-media-status-accept"></div>
<div id="rtc-supported-reject"></div>
<div id="rtc-supported-accept"></div>
<br>
<div id="ip-address"></div>
<script>
function check() {
detectRTC()
.then(_ => {
document.getElementById("rtc-supported-accept").innerHTML = 'WebRTC supported \n';
getLocalIPs()
.then(ips => {
console.log(ips)
ips = ips.join('\n');
document.getElementById("ip-address").innerHTML = "Local IP addresses detected by WebRTC:\n " + ips;
})
.catch(rejection => document.getElementById("ip-address").innerHTML = "Something got messed up with WebRTC API: " + rejection);
})
.catch(_ => {
document.getElementById("rtc-supported-reject").innerHTML = 'WebRTC not supported \n';
});
}
let constraints = { audio: true };
navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
document.getElementById("user-media-status-accept").innerHTML = 'Got user permission for mic. \n';
})
.catch(function(err) {
document.getElementById("user-media-status-reject").innerHTML = 'Did NOT get user permission for mic. \n';
})
.then(function() {
check();
})
</script>
</body>
</html>