forked from muaz-khan/DetectRTC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
317 lines (257 loc) · 14 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!--
> Muaz Khan - www.MuazKhan.com
> MIT License - www.WebRTC-Experiment.com/licence
> Documentation - github.com/muaz-khan/DetectRTC
> npm install detectrtc
> bower install detectrtc
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>DetectRTC.js / Detect WebRTC features! ® Muaz Khan</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="author" type="text/html" href="https://plus.google.com/+MuazKhan">
<meta name="author" content="Muaz Khan">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://cdn.webrtc-experiment.com/style.css">
<style>
audio {
vertical-align: bottom;
width: 10em;
}
video {
max-width: 100%;
vertical-align: top;
}
input {
border: 1px solid #d9d9d9;
border-radius: 1px;
font-size: 2em;
margin: .2em;
width: 30%;
}
p, .inner { padding: 1em; }
li {
border-bottom: 1px solid rgb(189, 189, 189);
border-left: 1px solid rgb(189, 189, 189);
padding: .5em;
}
label {
display: inline-block;
width: 8em;
}
</style>
<script>
document.createElement('article');
document.createElement('footer');
</script>
<!-- script used to detect WebRTC features! -->
<script src="DetectRTC.js"> </script>
<script src="https://cdn.webrtc-experiment.com/screenshot.js"></script>
</head>
<body>
<article>
<header style="text-align: center;">
<h1>
<a href="https://github.com/muaz-khan/DetectRTC">DetectRTC.js</a>: Detect <a href="https://www.webrtc-experiment.com/" target="_blank">WebRTC</a> features! ®
<a href="https://github.com/muaz-khan" target="_blank">Muaz Khan</a>
</h1>
<p>
<a href="https://www.webrtc-experiment.com/">HOME</a>
<span> © </span>
<a href="http://www.MuazKhan.com/" target="_blank">Muaz Khan</a>
.
<a href="http://twitter.com/WebRTCWeb" target="_blank" title="Twitter profile for WebRTC Experiments">@WebRTCWeb</a>
.
<a href="https://github.com/muaz-khan?tab=repositories" target="_blank" title="Github Profile">Github</a>
.
<a href="https://github.com/muaz-khan/DetectRTC/issues?state=open" target="_blank">Latest issues</a>
.
<a href="https://github.com/muaz-khan/DetectRTC/commits/master" target="_blank">What's New?</a>
</p>
</header>
<div class="github-stargazers"></div>
<section class="experiment" id="detectrtc-output">
<button id="save" style="float:right;">Print & Save As Image</button>
<h2 id="welcome">Detect WebRTC!</h2>
<table id="browser-features"></table>
</section>
<!-- dirty trick to bypass webrtc blockers -->
<iframe id="iframe" sandbox="allow-same-origin" style="display: none"></iframe>
<script>
var browserFeaturesTable = document.querySelector('#browser-features');
function appendTR(firstValue, secondValue) {
var tr = document.createElement('tr');
tr.innerHTML = '<td>' + firstValue + '</td><td>' + secondValue + '</td>';
browserFeaturesTable.appendChild(tr);
}
function printVal(value) {
return value == true ? 'Yep' : value == false ? 'Nope' : value;
}
DetectRTC.load(function() {
browserFeaturesTable.innerHTML = '';
appendTR('System has Speakers?', printVal(DetectRTC.hasSpeakers));
appendTR('System has Microphone?', printVal(DetectRTC.hasMicrophone));
appendTR('System has Webcam?', printVal(DetectRTC.hasWebcam));
appendTR('Browser allows getUserMedia on this page?', printVal(DetectRTC.isGetUserMediaSupported));
appendTR('Can you change output audio devices?', printVal(DetectRTC.isSetSinkIdSupported));
appendTR('Browser Supports WebRTC (Either 1.0 or 1.1)?', printVal(DetectRTC.isWebRTCSupported));
appendTR('Browser Supports ORTC (WebRTC 1.1)?', printVal(DetectRTC.isORTCSupported));
appendTR('Can you replace tracks without renegotiating peers?', printVal(DetectRTC.isRTPSenderReplaceTracksSupported));
appendTR('Can your browser record remote audio or process remote audio stream in WebAudio API?', printVal(DetectRTC.isRemoteStreamProcessingSupported));
appendTR('Browser Supports WebSockets API?', printVal(DetectRTC.isWebSocketsSupported));
appendTR('Your system blocked WebSockets protocol or WebSockets server is not accessible?', printVal(DetectRTC.isWebSocketsBlocked));
appendTR('Browser Supports WebAudio API?', printVal(DetectRTC.isAudioContextSupported));
appendTR('Browser Supports SCTP Data Channels?', printVal(DetectRTC.isSctpDataChannelsSupported));
appendTR('Browser Supports RTP Data Channels?', printVal(DetectRTC.isRtpDataChannelsSupported));
appendTR('This page Supports Screen Capturing API?', printVal(DetectRTC.isScreenCapturingSupported));
appendTR('Is it a mobile device?', printVal(DetectRTC.isMobileDevice));
appendTR('Browser Supports WebSockets?', printVal(DetectRTC.isWebSocketsSupported));
document.getElementById('welcome').innerHTML = DetectRTC.osName + ': ' + DetectRTC.browser.name + ' (version: ' + DetectRTC.browser.version + ')';
var rightSide = '';
var audioDevices = [];
var videoDevices = [];
DetectRTC.MediaDevices.forEach(function(device) {
if (device.kind.indexOf('audio') !== -1 && audioDevices.indexOf(device.label) == -1) {
audioDevices.push(device.label || 'unable to detect');
}
if (device.kind.indexOf('video') !== -1 && videoDevices.indexOf(device.label) == -1) {
videoDevices.push(device.label || 'unable to detect');
}
});
rightSide += '<h2>Audio Devices</h2><br>' + audioDevices.join('<br>');
rightSide += '<br><br><h2>Video Devices</h2><br>' + videoDevices.join('<br>');
appendTR(audioDevices.length + ' audio and ' + videoDevices.length + ' video devices', rightSide);
appendTR('Is Browser Supports Video Capturing from Canvas?', printVal(DetectRTC.isVideoSupportsStreamCapturing));
appendTR('Is Browser Supports Stream Capturing from Video?', printVal(DetectRTC.isVideoSupportsStreamCapturing));
DetectRTC.DetectLocalIPAddress(function(ipAddress) {
if (ipAddress.indexOf('Local') !== -1) {
appendTR('Your <strong>Local</strong> IP Address', ipAddress);
} else {
appendTR('Your <strong>Public</strong> IP Address', ipAddress);
}
});
});
document.getElementById('save').onclick = function() {
this.parentNode.removeChild(this);
html2canvas(browserFeaturesTable.parentNode, {
grabMouse: false,
onrendered: function(canvas) {
var image = canvas.toDataURL('image/jpeg');
// document.write('<img src="' + image +'">');
SaveToDisk(image);
}
});
};
function SaveToDisk(dataURL) {
if (DetectRTC.browser.isEdge) {
var blob = dataURLToBlob(dataURL);
if (typeof navigator.msSaveOrOpenBlob !== 'undefined') {
return navigator.msSaveOrOpenBlob(blob, 'DetectRTC.jpg');
} else if (typeof navigator.msSaveBlob !== 'undefined') {
return navigator.msSaveBlob(blob, 'DetectRTC.jpg');
}
}
var hyperlink = document.createElement('a');
hyperlink.href = dataURL;
hyperlink.target = '_blank';
hyperlink.download = 'DetectRTC.jpg';
if (DetectRTC.browser.name === 'Firefox') {
hyperlink.onclick = function() {
(document.body || document.documentElement).removeChild(hyperlink);
};
(document.body || document.documentElement).appendChild(hyperlink);
}
var evt = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
hyperlink.dispatchEvent(evt);
if (DetectRTC.browser.name === 'Firefox') {
URL.revokeObjectURL(hyperlink.href);
}
}
function dataURLToBlob(dataURL) {
var BASE64_MARKER = ';base64,';
if (dataURL.indexOf(BASE64_MARKER) == -1) {
var parts = dataURL.split(',');
var contentType = parts[0].split(':')[1];
var raw = decodeURIComponent(parts[1]);
return new Blob([raw], {
type: contentType
});
}
var parts = dataURL.split(BASE64_MARKER);
var contentType = parts[0].split(':')[1];
var raw = window.atob(parts[1]);
var rawLength = raw.length;
var uInt8Array = new Uint8Array(rawLength);
for (var i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], {
type: contentType
});
}
</script>
<section class="experiment"><img src="https://cdn.webrtc-experiment.com/images/DetectRTC.png" style="width:100%;" /></section>
<section class="experiment">
<h2 class="header" id="feedback">Feedback</h2>
<div>
<textarea id="message" style="border: 1px solid rgb(189, 189, 189); height: 8em; margin: .2em; outline: none; resize: vertical; width: 98%;" placeholder="Have any message? Suggestions or something went wrong?"></textarea>
</div>
<button id="send-message" style="font-size: 1em;">Send Message</button><small style="margin-left: 1em;">Enter your email too; if you want "direct" reply!</small>
</section>
<section class="experiment">
<h2 class="header">
How to use <a href="https://github.com/muaz-khan/DetectRTC" target="_blank">DetectRTC</a>?</h2>
<pre>
<script src="//cdn.WebRTC-Experiment.com/DetectRTC.js"></script>
</pre>
</section>
<section class="experiment">
<pre>
DetectRTC.load(function() {
// DetectRTC.hasWebcam (has webcam device!)
// DetectRTC.hasMicrophone (has microphone device!)
// DetectRTC.hasSpeakers (has speakers!)
// DetectRTC.isScreenCapturingSupported
// DetectRTC.isSctpDataChannelsSupported
// DetectRTC.isRtpDataChannelsSupported
// DetectRTC.isAudioContextSupported
// DetectRTC.isWebRTCSupported
// DetectRTC.isDesktopCapturingSupported
// DetectRTC.isMobileDevice
// DetectRTC.isWebSocketsSupported
// DetectRTC.osName
// DetectRTC.browser.name
// DetectRTC.browser.version
// DetectRTC.browser.isChrome
// DetectRTC.browser.isFirefox
// DetectRTC.browser.isOpera
// DetectRTC.browser.isIE
// DetectRTC.browser.isSafari
// DetectRTC.DetectLocalIPAddress(callback)
});
</pre>
</section>
<section class="experiment own-widgets latest-commits">
<h2 class="header" id="updates" style="color: red; padding-bottom: .1em;"><a href="https://github.com/muaz-khan/DetectRTC/commits/master" target="_blank">Latest Updates</a></h2>
<div id="github-commits"></div>
</section>
</article>
<a href="https://github.com/muaz-khan/DetectRTC" class="fork-left"></a>
<footer>
<p>
<a href="https://www.webrtc-experiment.com/">WebRTC Experiments</a>
© <a href="https://plus.google.com/+MuazKhan" rel="author" target="_blank">Muaz Khan</a>
<a href="mailto:[email protected]" target="_blank">[email protected]</a>
</p>
</footer>
<!-- commits.js is useless for you! -->
<script src="https://cdn.webrtc-experiment.com/commits.js" async> </script>
</body>
</html>