forked from steveseguin/vdo.ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser.html
More file actions
550 lines (469 loc) · 20.5 KB
/
browser.html
File metadata and controls
550 lines (469 loc) · 20.5 KB
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Device Information Detector</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
color: #333;
}
.container {
max-width: 800px;
margin: 0 auto;
}
.header {
text-align: center;
color: white;
margin-bottom: 30px;
}
.header h1 {
font-size: 2rem;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
}
.info-card {
background: white;
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
transition: transform 0.3s ease;
}
.info-card:hover {
transform: translateY(-2px);
box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}
.info-section {
margin-bottom: 25px;
padding-bottom: 25px;
border-bottom: 1px solid #eee;
}
.info-section:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.section-title {
font-size: 1.3rem;
color: #667eea;
margin-bottom: 15px;
font-weight: 600;
}
.info-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #f5f5f5;
}
.info-item:last-child {
border-bottom: none;
}
.info-label {
font-weight: 500;
color: #666;
}
.info-value {
font-weight: 600;
color: #333;
text-align: right;
max-width: 60%;
word-break: break-word;
}
.info-value.true {
color: #4caf50;
}
.info-value.false {
color: #f44336;
}
.info-value.number {
color: #2196f3;
}
.performance-indicator {
display: inline-block;
padding: 4px 12px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 600;
}
.performance-0 {
background: #4caf50;
color: white;
}
.performance-1 {
background: #ff9800;
color: white;
}
.performance-2 {
background: #f44336;
color: white;
}
.safari-highlight {
background: #fffacd;
padding: 15px;
border-radius: 10px;
border: 2px solid #ffd700;
}
@media (max-width: 600px) {
.header h1 {
font-size: 1.5rem;
}
.info-item {
flex-direction: column;
align-items: flex-start;
}
.info-value {
max-width: 100%;
text-align: left;
margin-top: 5px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Device Information Detector</h1>
<p>Comprehensive browser and device capability detection</p>
</div>
<div class="info-card">
<div class="info-section safari-highlight">
<h2 class="section-title">🦁 Safari/WebKit Version</h2>
<div class="info-item">
<span class="info-label">Safari Version</span>
<span class="info-value number" id="safari-version">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">iOS Version</span>
<span class="info-value number" id="ios-version">Detecting...</span>
</div>
</div>
<div class="info-section">
<h2 class="section-title">🌐 Browser Detection</h2>
<div class="info-item">
<span class="info-label">Firefox</span>
<span class="info-value" id="firefox">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Chromium Version</span>
<span class="info-value" id="chromium">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Opera GX</span>
<span class="info-value" id="opera-gx">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Vingester</span>
<span class="info-value" id="vingester">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">MELD</span>
<span class="info-value" id="meld">Detecting...</span>
</div>
</div>
<div class="info-section">
<h2 class="section-title">📱 Device Detection</h2>
<div class="info-item">
<span class="info-label">iOS</span>
<span class="info-value" id="ios">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">iPad</span>
<span class="info-value" id="ipad">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">macOS</span>
<span class="info-value" id="macos">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Intel Mac</span>
<span class="info-value" id="intel-mac">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Android</span>
<span class="info-value" id="android">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Samsung A Series</span>
<span class="info-value" id="samsung-a">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">iPhone 12+</span>
<span class="info-value" id="iphone12">Detecting...</span>
</div>
</div>
<div class="info-section">
<h2 class="section-title">⚡ Hardware Capabilities</h2>
<div class="info-item">
<span class="info-label">CPU Threads</span>
<span class="info-value" id="cpu">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">GPU</span>
<span class="info-value" id="gpu">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Wake Lock Support</span>
<span class="info-value" id="wake-lock">Detecting...</span>
</div>
<div class="info-item">
<span class="info-label">Performance Score</span>
<span class="info-value" id="performance">Detecting...</span>
</div>
</div>
<div class="info-section">
<h2 class="section-title">📊 Raw Data</h2>
<div class="info-item">
<span class="info-label">User Agent</span>
<span class="info-value" id="user-agent" style="font-size: 0.8rem;">Detecting...</span>
</div>
</div>
</div>
</div>
<script>
// Stub for missing functions/objects
function log(msg) { console.log(msg); }
function errorlog(e) { console.error(e); }
var session = {
quality_wb: 0,
quality_room: 0,
mobile: false,
audioCtx: null
};
// Your original functions (preserved exactly)
function detectCPUSupport() {
let cpuThreads = navigator.hardwareConcurrency;
if (cpuThreads) {
return cpuThreads + " threads";
}
return false;
}
function detectGPUSupport() {
try {
const gl = document.createElement("canvas").getContext("webgl");
if (!gl) {
return false;
}
if (!Firefox) {
try {
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info"); // chrome
if (debugInfo) {
return gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}
} catch (e) {}
}
try {
return gl.getParameter(gl.RENDERER) || false; // firefox
} catch (e) {}
} catch (e) {}
return false;
}
function isOperaGX() {
return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(" OPR/75") >= 0;
}
function isSamsungASeries() {
return navigator.userAgent.includes("; SM-A") || false;
}
function getChromiumVersion() {
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return raw ? parseInt(raw[2], 10) : false;
}
function getiOSVersion() {
try {
var agent = navigator.userAgent;
var start = agent.indexOf("OS ");
if ((agent.indexOf("iPhone") > -1 || agent.indexOf("iPad") > -1) && start > -1) {
return window.Number(agent.substr(start + 3, 3).replace("_", "."));
}
return 0;
} catch (e) {
return 0;
}
return 0;
}
function safariVersion() {
var ver = 0;
try {
ver = navigator.appVersion.split("Version/");
if (ver.length > 1) {
ver = ver[1].split(" Safari");
}
if (ver.length > 1) {
ver = ver[0].split(".");
}
if (ver.length > 1) {
ver = parseInt(ver[0]);
} else {
ver = 0;
}
} catch (e) {
return 0;
}
return ver;
}
function isIntelMac() {
// Check if it's a Mac but not Apple Silicon
if (macOS && navigator.userAgent.indexOf("Intel") >= 0) {
return true;
}
return false;
}
function judgePerformance(){
try {
if (SafariVersion && SafariVersion >= 17 && (iOS || iPad)) { // iphone xr or newer
return 0;
}
const cores = typeof navigator.hardwareConcurrency === 'number' ? navigator.hardwareConcurrency : 0;
if (isIntelMac()) {
if (cores < 6) { // yes. they are that bad.
return 2;
} else {
return 1;
}
}
if (session.mobile && (cores>=4)){ // assume hardware encoded acceleration
return 0;
}
if (!cores){
return 1;
} else if (cores < 4 ){
return 2;
} else if (cores>8){
return 0;
}
return 1
} catch (e) {
return 1; // 99% safe default
}
}
const needsLegacyWakeLock = () => {
try {
if ('wakeLock' in navigator) {
if (Firefox) { // using your existing Firefox detection
return true;
}
if ((iOS || iPad) && SafariVersion < 16.4) { // using your existing iOS/iPad/SafariVersion detection
return true;
}
return false;
}
} catch(e){}
return true; // No Wake Lock API, need legacy keep alive for mobile
};
// Your original detection code
try {
var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); // used by main.js also
var iPad = navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform);
var macOS = navigator.userAgent.indexOf("Mac OS X") != -1;
macOS = macOS && !(iOS || iPad);
var Firefox = navigator.userAgent.indexOf("Firefox") >= 0;
if (Firefox) {
Firefox = parseInt(navigator.userAgent.split("irefox/").pop()) || true;
}
var Android = navigator.userAgent.toLowerCase().indexOf("android") > -1; //&& ua.indexOf("mobile");
var ChromiumVersion = getChromiumVersion();
var OperaGx = isOperaGX();
var SafariVersion = safariVersion() || getiOSVersion(); // I should rename this to webkit
if (iOS || iPad) {
// iOS doesn't yet allow actual browsers, cause it's abusing its duopoly.
if (SafariVersion) {
if (Firefox) {
Firefox = false; // I should rename this to gecko
}
if (ChromiumVersion) {
ChromiumVersion = false; // I should rename this to chromium
}
}
}
var SamsungASeries = isSamsungASeries();
var isVingester = navigator.userAgent.indexOf("Vingester") >= 0;
var gpgpuSupport = detectGPUSupport(); // graphics ; not supported on ios
log(gpgpuSupport);
var cpuSupport = detectCPUSupport(); // thread count ; supported on ios
log(cpuSupport);
var iPhone12Up = false;
var isMELD = false;
if (typeof navigator!== 'undefined' && navigator.userAgent && navigator.userAgent.includes("Meld/")) {
isMELD = true;
}
if (iOS && !iPad) {
if (window.devicePixelRatio.toFixed(2) >= 3 && window.screen.height > 800 && window.screen.width != 414) {
// for reference, https://www.ios-resolution.com/
iPhone12Up = true; // iPhone SE is left out.
}
}
// Detect mobile
session.mobile = iOS || iPad || Android;
session.quality_wb = judgePerformance(); // try to estimate what resolution to use for encoding when not in a room.
if (session.quality_room < session.quality_wb){
session.quality_room = session.quality_wb;
}
} catch (e) {
errorlog(e);
}
// Display results
function updateDisplay() {
// Safari/iOS versions
document.getElementById('safari-version').textContent = safariVersion() || 'Not Safari';
document.getElementById('safari-version').className = 'info-value ' + (safariVersion() ? 'number' : 'false');
document.getElementById('ios-version').textContent = getiOSVersion() || 'Not iOS';
document.getElementById('ios-version').className = 'info-value ' + (getiOSVersion() ? 'number' : 'false');
// Browser detection
document.getElementById('firefox').textContent = Firefox || 'No';
document.getElementById('firefox').className = 'info-value ' + (Firefox ? 'true' : 'false');
document.getElementById('chromium').textContent = ChromiumVersion || 'No';
document.getElementById('chromium').className = 'info-value ' + (ChromiumVersion ? 'number' : 'false');
document.getElementById('opera-gx').textContent = OperaGx ? 'Yes' : 'No';
document.getElementById('opera-gx').className = 'info-value ' + (OperaGx ? 'true' : 'false');
document.getElementById('vingester').textContent = isVingester ? 'Yes' : 'No';
document.getElementById('vingester').className = 'info-value ' + (isVingester ? 'true' : 'false');
document.getElementById('meld').textContent = isMELD ? 'Yes' : 'No';
document.getElementById('meld').className = 'info-value ' + (isMELD ? 'true' : 'false');
// Device detection
document.getElementById('ios').textContent = iOS ? 'Yes' : 'No';
document.getElementById('ios').className = 'info-value ' + (iOS ? 'true' : 'false');
document.getElementById('ipad').textContent = iPad ? 'Yes' : 'No';
document.getElementById('ipad').className = 'info-value ' + (iPad ? 'true' : 'false');
document.getElementById('macos').textContent = macOS ? 'Yes' : 'No';
document.getElementById('macos').className = 'info-value ' + (macOS ? 'true' : 'false');
document.getElementById('intel-mac').textContent = isIntelMac() ? 'Yes' : 'No';
document.getElementById('intel-mac').className = 'info-value ' + (isIntelMac() ? 'true' : 'false');
document.getElementById('android').textContent = Android ? 'Yes' : 'No';
document.getElementById('android').className = 'info-value ' + (Android ? 'true' : 'false');
document.getElementById('samsung-a').textContent = SamsungASeries ? 'Yes' : 'No';
document.getElementById('samsung-a').className = 'info-value ' + (SamsungASeries ? 'true' : 'false');
document.getElementById('iphone12').textContent = iPhone12Up ? 'Yes' : 'No';
document.getElementById('iphone12').className = 'info-value ' + (iPhone12Up ? 'true' : 'false');
// Hardware
document.getElementById('cpu').textContent = cpuSupport || 'Not detected';
document.getElementById('cpu').className = 'info-value ' + (cpuSupport ? 'number' : 'false');
document.getElementById('gpu').textContent = gpgpuSupport || 'Not detected';
document.getElementById('gpu').className = 'info-value ' + (gpgpuSupport ? 'true' : 'false');
document.getElementById('wake-lock').textContent = needsLegacyWakeLock() ? 'Legacy needed' : 'Modern API';
document.getElementById('wake-lock').className = 'info-value ' + (needsLegacyWakeLock() ? 'false' : 'true');
// Performance
const perfScore = session.quality_wb;
const perfText = perfScore === 0 ? 'High' : perfScore === 1 ? 'Medium' : 'Low';
document.getElementById('performance').innerHTML = `<span class="performance-indicator performance-${perfScore}">${perfText} (${perfScore})</span>`;
// User agent
document.getElementById('user-agent').textContent = navigator.userAgent;
}
// Run detection when page loads
updateDisplay();
</script>
</body>
</html>