@webex/internal-media-core 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +288 -1316
- package/dist/esm/index.js +289 -1316
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -18,1303 +18,6 @@ function _mergeNamespaces(n, m) {
|
|
|
18
18
|
return Object.freeze(n);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
var global$1 = (typeof global !== "undefined" ? global :
|
|
22
|
-
typeof self !== "undefined" ? self :
|
|
23
|
-
typeof window !== "undefined" ? window : {});
|
|
24
|
-
|
|
25
|
-
// shim for using process in browser
|
|
26
|
-
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
27
|
-
|
|
28
|
-
function defaultSetTimout() {
|
|
29
|
-
throw new Error('setTimeout has not been defined');
|
|
30
|
-
}
|
|
31
|
-
function defaultClearTimeout () {
|
|
32
|
-
throw new Error('clearTimeout has not been defined');
|
|
33
|
-
}
|
|
34
|
-
var cachedSetTimeout = defaultSetTimout;
|
|
35
|
-
var cachedClearTimeout = defaultClearTimeout;
|
|
36
|
-
if (typeof global$1.setTimeout === 'function') {
|
|
37
|
-
cachedSetTimeout = setTimeout;
|
|
38
|
-
}
|
|
39
|
-
if (typeof global$1.clearTimeout === 'function') {
|
|
40
|
-
cachedClearTimeout = clearTimeout;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function runTimeout(fun) {
|
|
44
|
-
if (cachedSetTimeout === setTimeout) {
|
|
45
|
-
//normal enviroments in sane situations
|
|
46
|
-
return setTimeout(fun, 0);
|
|
47
|
-
}
|
|
48
|
-
// if setTimeout wasn't available but was latter defined
|
|
49
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
50
|
-
cachedSetTimeout = setTimeout;
|
|
51
|
-
return setTimeout(fun, 0);
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
55
|
-
return cachedSetTimeout(fun, 0);
|
|
56
|
-
} catch(e){
|
|
57
|
-
try {
|
|
58
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
59
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
60
|
-
} catch(e){
|
|
61
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
62
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
function runClearTimeout(marker) {
|
|
69
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
70
|
-
//normal enviroments in sane situations
|
|
71
|
-
return clearTimeout(marker);
|
|
72
|
-
}
|
|
73
|
-
// if clearTimeout wasn't available but was latter defined
|
|
74
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
75
|
-
cachedClearTimeout = clearTimeout;
|
|
76
|
-
return clearTimeout(marker);
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
80
|
-
return cachedClearTimeout(marker);
|
|
81
|
-
} catch (e){
|
|
82
|
-
try {
|
|
83
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
84
|
-
return cachedClearTimeout.call(null, marker);
|
|
85
|
-
} catch (e){
|
|
86
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
87
|
-
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
88
|
-
return cachedClearTimeout.call(this, marker);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
var queue$2 = [];
|
|
96
|
-
var draining = false;
|
|
97
|
-
var currentQueue;
|
|
98
|
-
var queueIndex = -1;
|
|
99
|
-
|
|
100
|
-
function cleanUpNextTick() {
|
|
101
|
-
if (!draining || !currentQueue) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
draining = false;
|
|
105
|
-
if (currentQueue.length) {
|
|
106
|
-
queue$2 = currentQueue.concat(queue$2);
|
|
107
|
-
} else {
|
|
108
|
-
queueIndex = -1;
|
|
109
|
-
}
|
|
110
|
-
if (queue$2.length) {
|
|
111
|
-
drainQueue();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function drainQueue() {
|
|
116
|
-
if (draining) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
var timeout = runTimeout(cleanUpNextTick);
|
|
120
|
-
draining = true;
|
|
121
|
-
|
|
122
|
-
var len = queue$2.length;
|
|
123
|
-
while(len) {
|
|
124
|
-
currentQueue = queue$2;
|
|
125
|
-
queue$2 = [];
|
|
126
|
-
while (++queueIndex < len) {
|
|
127
|
-
if (currentQueue) {
|
|
128
|
-
currentQueue[queueIndex].run();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
queueIndex = -1;
|
|
132
|
-
len = queue$2.length;
|
|
133
|
-
}
|
|
134
|
-
currentQueue = null;
|
|
135
|
-
draining = false;
|
|
136
|
-
runClearTimeout(timeout);
|
|
137
|
-
}
|
|
138
|
-
function nextTick(fun) {
|
|
139
|
-
var args = new Array(arguments.length - 1);
|
|
140
|
-
if (arguments.length > 1) {
|
|
141
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
142
|
-
args[i - 1] = arguments[i];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
queue$2.push(new Item(fun, args));
|
|
146
|
-
if (queue$2.length === 1 && !draining) {
|
|
147
|
-
runTimeout(drainQueue);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// v8 likes predictible objects
|
|
151
|
-
function Item(fun, array) {
|
|
152
|
-
this.fun = fun;
|
|
153
|
-
this.array = array;
|
|
154
|
-
}
|
|
155
|
-
Item.prototype.run = function () {
|
|
156
|
-
this.fun.apply(null, this.array);
|
|
157
|
-
};
|
|
158
|
-
var title = 'browser';
|
|
159
|
-
var platform = 'browser';
|
|
160
|
-
var browser = true;
|
|
161
|
-
var env = {};
|
|
162
|
-
var argv = [];
|
|
163
|
-
var version = ''; // empty string to avoid regexp issues
|
|
164
|
-
var versions = {};
|
|
165
|
-
var release = {};
|
|
166
|
-
var config = {};
|
|
167
|
-
|
|
168
|
-
function noop() {}
|
|
169
|
-
|
|
170
|
-
var on$1 = noop;
|
|
171
|
-
var addListener = noop;
|
|
172
|
-
var once$4 = noop;
|
|
173
|
-
var off$1 = noop;
|
|
174
|
-
var removeListener = noop;
|
|
175
|
-
var removeAllListeners = noop;
|
|
176
|
-
var emit = noop;
|
|
177
|
-
|
|
178
|
-
function binding(name) {
|
|
179
|
-
throw new Error('process.binding is not supported');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function cwd () { return '/' }
|
|
183
|
-
function chdir (dir) {
|
|
184
|
-
throw new Error('process.chdir is not supported');
|
|
185
|
-
}function umask() { return 0; }
|
|
186
|
-
|
|
187
|
-
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
188
|
-
var performance$1 = global$1.performance || {};
|
|
189
|
-
var performanceNow =
|
|
190
|
-
performance$1.now ||
|
|
191
|
-
performance$1.mozNow ||
|
|
192
|
-
performance$1.msNow ||
|
|
193
|
-
performance$1.oNow ||
|
|
194
|
-
performance$1.webkitNow ||
|
|
195
|
-
function(){ return (new Date()).getTime() };
|
|
196
|
-
|
|
197
|
-
// generate timestamp or delta
|
|
198
|
-
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
199
|
-
function hrtime(previousTimestamp){
|
|
200
|
-
var clocktime = performanceNow.call(performance$1)*1e-3;
|
|
201
|
-
var seconds = Math.floor(clocktime);
|
|
202
|
-
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
|
203
|
-
if (previousTimestamp) {
|
|
204
|
-
seconds = seconds - previousTimestamp[0];
|
|
205
|
-
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
206
|
-
if (nanoseconds<0) {
|
|
207
|
-
seconds--;
|
|
208
|
-
nanoseconds += 1e9;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return [seconds,nanoseconds]
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
var startTime = new Date();
|
|
215
|
-
function uptime() {
|
|
216
|
-
var currentTime = new Date();
|
|
217
|
-
var dif = currentTime - startTime;
|
|
218
|
-
return dif / 1000;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
var browser$1 = {
|
|
222
|
-
nextTick: nextTick,
|
|
223
|
-
title: title,
|
|
224
|
-
browser: browser,
|
|
225
|
-
env: env,
|
|
226
|
-
argv: argv,
|
|
227
|
-
version: version,
|
|
228
|
-
versions: versions,
|
|
229
|
-
on: on$1,
|
|
230
|
-
addListener: addListener,
|
|
231
|
-
once: once$4,
|
|
232
|
-
off: off$1,
|
|
233
|
-
removeListener: removeListener,
|
|
234
|
-
removeAllListeners: removeAllListeners,
|
|
235
|
-
emit: emit,
|
|
236
|
-
binding: binding,
|
|
237
|
-
cwd: cwd,
|
|
238
|
-
chdir: chdir,
|
|
239
|
-
umask: umask,
|
|
240
|
-
hrtime: hrtime,
|
|
241
|
-
platform: platform,
|
|
242
|
-
release: release,
|
|
243
|
-
config: config,
|
|
244
|
-
uptime: uptime
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
var commonjsGlobal$4 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
248
|
-
|
|
249
|
-
var DetectRTC = {exports: {}};
|
|
250
|
-
|
|
251
|
-
(function (module) {
|
|
252
|
-
|
|
253
|
-
// Last Updated On: 2020-08-12 11:18:41 AM UTC
|
|
254
|
-
|
|
255
|
-
// ________________
|
|
256
|
-
// DetectRTC v1.4.1
|
|
257
|
-
|
|
258
|
-
// Open-Sourced: https://github.com/muaz-khan/DetectRTC
|
|
259
|
-
|
|
260
|
-
// --------------------------------------------------
|
|
261
|
-
// Muaz Khan - www.MuazKhan.com
|
|
262
|
-
// MIT License - www.WebRTC-Experiment.com/licence
|
|
263
|
-
// --------------------------------------------------
|
|
264
|
-
(function () {
|
|
265
|
-
var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';
|
|
266
|
-
var isNodejs = typeof browser$1 === 'object' && typeof browser$1.versions === 'object' && browser$1.versions.node && /*node-process*/!browser$1.browser;
|
|
267
|
-
if (isNodejs) {
|
|
268
|
-
var version = browser$1.versions.node.toString().replace('v', '');
|
|
269
|
-
browserFakeUserAgent = 'Nodejs/' + version + ' (NodeOS) AppleWebKit/' + version + ' (KHTML, like Gecko) Nodejs/' + version + ' Nodejs/' + version;
|
|
270
|
-
}
|
|
271
|
-
(function (that) {
|
|
272
|
-
if (typeof window !== 'undefined') {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (typeof window === 'undefined' && typeof commonjsGlobal$4 !== 'undefined') {
|
|
276
|
-
commonjsGlobal$4.navigator = {
|
|
277
|
-
userAgent: browserFakeUserAgent,
|
|
278
|
-
getUserMedia: function getUserMedia() {}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
/*global window:true */
|
|
282
|
-
that.window = commonjsGlobal$4;
|
|
283
|
-
}
|
|
284
|
-
if (typeof location === 'undefined') {
|
|
285
|
-
/*global location:true */
|
|
286
|
-
that.location = {
|
|
287
|
-
protocol: 'file:',
|
|
288
|
-
href: '',
|
|
289
|
-
hash: ''
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
if (typeof screen === 'undefined') {
|
|
293
|
-
/*global screen:true */
|
|
294
|
-
that.screen = {
|
|
295
|
-
width: 0,
|
|
296
|
-
height: 0
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
})(typeof commonjsGlobal$4 !== 'undefined' ? commonjsGlobal$4 : window);
|
|
300
|
-
|
|
301
|
-
/*global navigator:true */
|
|
302
|
-
var navigator = window.navigator;
|
|
303
|
-
if (typeof navigator !== 'undefined') {
|
|
304
|
-
if (typeof navigator.webkitGetUserMedia !== 'undefined') {
|
|
305
|
-
navigator.getUserMedia = navigator.webkitGetUserMedia;
|
|
306
|
-
}
|
|
307
|
-
if (typeof navigator.mozGetUserMedia !== 'undefined') {
|
|
308
|
-
navigator.getUserMedia = navigator.mozGetUserMedia;
|
|
309
|
-
}
|
|
310
|
-
} else {
|
|
311
|
-
navigator = {
|
|
312
|
-
getUserMedia: function getUserMedia() {},
|
|
313
|
-
userAgent: browserFakeUserAgent
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
var isMobileDevice = !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(navigator.userAgent || '');
|
|
317
|
-
var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob);
|
|
318
|
-
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
319
|
-
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && 'netscape' in window && / rv:/.test(navigator.userAgent);
|
|
320
|
-
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
321
|
-
var isChrome = !!window.chrome && !isOpera;
|
|
322
|
-
var isIE = typeof document !== 'undefined' && !!document.documentMode && !isEdge;
|
|
323
|
-
|
|
324
|
-
// this one can also be used:
|
|
325
|
-
// https://www.websocket.org/js/stuff.js (DetectBrowser.js)
|
|
326
|
-
|
|
327
|
-
function getBrowserInfo() {
|
|
328
|
-
navigator.appVersion;
|
|
329
|
-
var nAgt = navigator.userAgent;
|
|
330
|
-
var browserName = navigator.appName;
|
|
331
|
-
var fullVersion = '' + parseFloat(navigator.appVersion);
|
|
332
|
-
var majorVersion = parseInt(navigator.appVersion, 10);
|
|
333
|
-
var nameOffset, verOffset, ix;
|
|
334
|
-
|
|
335
|
-
// In Opera, the true version is after 'Opera' or after 'Version'
|
|
336
|
-
if (isOpera) {
|
|
337
|
-
browserName = 'Opera';
|
|
338
|
-
try {
|
|
339
|
-
fullVersion = navigator.userAgent.split('OPR/')[1].split(' ')[0];
|
|
340
|
-
majorVersion = fullVersion.split('.')[0];
|
|
341
|
-
} catch (e) {
|
|
342
|
-
fullVersion = '0.0.0.0';
|
|
343
|
-
majorVersion = 0;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
// In MSIE version <=10, the true version is after 'MSIE' in userAgent
|
|
347
|
-
// In IE 11, look for the string after 'rv:'
|
|
348
|
-
else if (isIE) {
|
|
349
|
-
verOffset = nAgt.indexOf('rv:');
|
|
350
|
-
if (verOffset > 0) {
|
|
351
|
-
//IE 11
|
|
352
|
-
fullVersion = nAgt.substring(verOffset + 3);
|
|
353
|
-
} else {
|
|
354
|
-
//IE 10 or earlier
|
|
355
|
-
verOffset = nAgt.indexOf('MSIE');
|
|
356
|
-
fullVersion = nAgt.substring(verOffset + 5);
|
|
357
|
-
}
|
|
358
|
-
browserName = 'IE';
|
|
359
|
-
}
|
|
360
|
-
// In Chrome, the true version is after 'Chrome'
|
|
361
|
-
else if (isChrome) {
|
|
362
|
-
verOffset = nAgt.indexOf('Chrome');
|
|
363
|
-
browserName = 'Chrome';
|
|
364
|
-
fullVersion = nAgt.substring(verOffset + 7);
|
|
365
|
-
}
|
|
366
|
-
// In Safari, the true version is after 'Safari' or after 'Version'
|
|
367
|
-
else if (isSafari) {
|
|
368
|
-
// both and safri and chrome has same userAgent
|
|
369
|
-
if (nAgt.indexOf('CriOS') !== -1) {
|
|
370
|
-
verOffset = nAgt.indexOf('CriOS');
|
|
371
|
-
browserName = 'Chrome';
|
|
372
|
-
fullVersion = nAgt.substring(verOffset + 6);
|
|
373
|
-
} else if (nAgt.indexOf('FxiOS') !== -1) {
|
|
374
|
-
verOffset = nAgt.indexOf('FxiOS');
|
|
375
|
-
browserName = 'Firefox';
|
|
376
|
-
fullVersion = nAgt.substring(verOffset + 6);
|
|
377
|
-
} else {
|
|
378
|
-
verOffset = nAgt.indexOf('Safari');
|
|
379
|
-
browserName = 'Safari';
|
|
380
|
-
fullVersion = nAgt.substring(verOffset + 7);
|
|
381
|
-
if ((verOffset = nAgt.indexOf('Version')) !== -1) {
|
|
382
|
-
fullVersion = nAgt.substring(verOffset + 8);
|
|
383
|
-
}
|
|
384
|
-
if (navigator.userAgent.indexOf('Version/') !== -1) {
|
|
385
|
-
fullVersion = navigator.userAgent.split('Version/')[1].split(' ')[0];
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
// In Firefox, the true version is after 'Firefox'
|
|
390
|
-
else if (isFirefox) {
|
|
391
|
-
verOffset = nAgt.indexOf('Firefox');
|
|
392
|
-
browserName = 'Firefox';
|
|
393
|
-
fullVersion = nAgt.substring(verOffset + 8);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// In most other browsers, 'name/version' is at the end of userAgent
|
|
397
|
-
else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
|
|
398
|
-
browserName = nAgt.substring(nameOffset, verOffset);
|
|
399
|
-
fullVersion = nAgt.substring(verOffset + 1);
|
|
400
|
-
if (browserName.toLowerCase() === browserName.toUpperCase()) {
|
|
401
|
-
browserName = navigator.appName;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (isEdge) {
|
|
405
|
-
browserName = 'Edge';
|
|
406
|
-
fullVersion = navigator.userAgent.split('Edge/')[1];
|
|
407
|
-
// fullVersion = parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10).toString();
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// trim the fullVersion string at semicolon/space/bracket if present
|
|
411
|
-
if ((ix = fullVersion.search(/[; \)]/)) !== -1) {
|
|
412
|
-
fullVersion = fullVersion.substring(0, ix);
|
|
413
|
-
}
|
|
414
|
-
majorVersion = parseInt('' + fullVersion, 10);
|
|
415
|
-
if (isNaN(majorVersion)) {
|
|
416
|
-
fullVersion = '' + parseFloat(navigator.appVersion);
|
|
417
|
-
majorVersion = parseInt(navigator.appVersion, 10);
|
|
418
|
-
}
|
|
419
|
-
return {
|
|
420
|
-
fullVersion: fullVersion,
|
|
421
|
-
version: majorVersion,
|
|
422
|
-
name: browserName,
|
|
423
|
-
isPrivateBrowsing: false
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// via: https://gist.github.com/cou929/7973956
|
|
428
|
-
|
|
429
|
-
function retry(isDone, next) {
|
|
430
|
-
var currentTrial = 0,
|
|
431
|
-
maxRetry = 50,
|
|
432
|
-
isTimeout = false;
|
|
433
|
-
var id = window.setInterval(function () {
|
|
434
|
-
if (isDone()) {
|
|
435
|
-
window.clearInterval(id);
|
|
436
|
-
next(isTimeout);
|
|
437
|
-
}
|
|
438
|
-
if (currentTrial++ > maxRetry) {
|
|
439
|
-
window.clearInterval(id);
|
|
440
|
-
isTimeout = true;
|
|
441
|
-
next(isTimeout);
|
|
442
|
-
}
|
|
443
|
-
}, 10);
|
|
444
|
-
}
|
|
445
|
-
function isIE10OrLater(userAgent) {
|
|
446
|
-
var ua = userAgent.toLowerCase();
|
|
447
|
-
if (ua.indexOf('msie') === 0 && ua.indexOf('trident') === 0) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
var match = /(?:msie|rv:)\s?([\d\.]+)/.exec(ua);
|
|
451
|
-
if (match && parseInt(match[1], 10) >= 10) {
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
function detectPrivateMode(callback) {
|
|
457
|
-
var isPrivate;
|
|
458
|
-
try {
|
|
459
|
-
if (window.webkitRequestFileSystem) {
|
|
460
|
-
window.webkitRequestFileSystem(window.TEMPORARY, 1, function () {
|
|
461
|
-
isPrivate = false;
|
|
462
|
-
}, function (e) {
|
|
463
|
-
isPrivate = true;
|
|
464
|
-
});
|
|
465
|
-
} else if (window.indexedDB && /Firefox/.test(window.navigator.userAgent)) {
|
|
466
|
-
var db;
|
|
467
|
-
try {
|
|
468
|
-
db = window.indexedDB.open('test');
|
|
469
|
-
db.onerror = function () {
|
|
470
|
-
return true;
|
|
471
|
-
};
|
|
472
|
-
} catch (e) {
|
|
473
|
-
isPrivate = true;
|
|
474
|
-
}
|
|
475
|
-
if (typeof isPrivate === 'undefined') {
|
|
476
|
-
retry(function isDone() {
|
|
477
|
-
return db.readyState === 'done' ? true : false;
|
|
478
|
-
}, function next(isTimeout) {
|
|
479
|
-
if (!isTimeout) {
|
|
480
|
-
isPrivate = db.result ? false : true;
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
} else if (isIE10OrLater(window.navigator.userAgent)) {
|
|
485
|
-
isPrivate = false;
|
|
486
|
-
try {
|
|
487
|
-
if (!window.indexedDB) {
|
|
488
|
-
isPrivate = true;
|
|
489
|
-
}
|
|
490
|
-
} catch (e) {
|
|
491
|
-
isPrivate = true;
|
|
492
|
-
}
|
|
493
|
-
} else if (window.localStorage && /Safari/.test(window.navigator.userAgent)) {
|
|
494
|
-
try {
|
|
495
|
-
window.localStorage.setItem('test', 1);
|
|
496
|
-
} catch (e) {
|
|
497
|
-
isPrivate = true;
|
|
498
|
-
}
|
|
499
|
-
if (typeof isPrivate === 'undefined') {
|
|
500
|
-
isPrivate = false;
|
|
501
|
-
window.localStorage.removeItem('test');
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
} catch (e) {
|
|
505
|
-
isPrivate = false;
|
|
506
|
-
}
|
|
507
|
-
retry(function isDone() {
|
|
508
|
-
return typeof isPrivate !== 'undefined' ? true : false;
|
|
509
|
-
}, function next(isTimeout) {
|
|
510
|
-
callback(isPrivate);
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
var isMobile = {
|
|
514
|
-
Android: function Android() {
|
|
515
|
-
return navigator.userAgent.match(/Android/i);
|
|
516
|
-
},
|
|
517
|
-
BlackBerry: function BlackBerry() {
|
|
518
|
-
return navigator.userAgent.match(/BlackBerry|BB10/i);
|
|
519
|
-
},
|
|
520
|
-
iOS: function iOS() {
|
|
521
|
-
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
|
522
|
-
},
|
|
523
|
-
Opera: function Opera() {
|
|
524
|
-
return navigator.userAgent.match(/Opera Mini/i);
|
|
525
|
-
},
|
|
526
|
-
Windows: function Windows() {
|
|
527
|
-
return navigator.userAgent.match(/IEMobile/i);
|
|
528
|
-
},
|
|
529
|
-
any: function any() {
|
|
530
|
-
return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows();
|
|
531
|
-
},
|
|
532
|
-
getOsName: function getOsName() {
|
|
533
|
-
var osName = 'Unknown OS';
|
|
534
|
-
if (isMobile.Android()) {
|
|
535
|
-
osName = 'Android';
|
|
536
|
-
}
|
|
537
|
-
if (isMobile.BlackBerry()) {
|
|
538
|
-
osName = 'BlackBerry';
|
|
539
|
-
}
|
|
540
|
-
if (isMobile.iOS()) {
|
|
541
|
-
osName = 'iOS';
|
|
542
|
-
}
|
|
543
|
-
if (isMobile.Opera()) {
|
|
544
|
-
osName = 'Opera Mini';
|
|
545
|
-
}
|
|
546
|
-
if (isMobile.Windows()) {
|
|
547
|
-
osName = 'Windows';
|
|
548
|
-
}
|
|
549
|
-
return osName;
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// via: http://jsfiddle.net/ChristianL/AVyND/
|
|
554
|
-
function detectDesktopOS() {
|
|
555
|
-
var unknown = '-';
|
|
556
|
-
var nVer = navigator.appVersion;
|
|
557
|
-
var nAgt = navigator.userAgent;
|
|
558
|
-
var os = unknown;
|
|
559
|
-
var clientStrings = [{
|
|
560
|
-
s: 'Chrome OS',
|
|
561
|
-
r: /CrOS/
|
|
562
|
-
}, {
|
|
563
|
-
s: 'Windows 10',
|
|
564
|
-
r: /(Windows 10.0|Windows NT 10.0)/
|
|
565
|
-
}, {
|
|
566
|
-
s: 'Windows 8.1',
|
|
567
|
-
r: /(Windows 8.1|Windows NT 6.3)/
|
|
568
|
-
}, {
|
|
569
|
-
s: 'Windows 8',
|
|
570
|
-
r: /(Windows 8|Windows NT 6.2)/
|
|
571
|
-
}, {
|
|
572
|
-
s: 'Windows 7',
|
|
573
|
-
r: /(Windows 7|Windows NT 6.1)/
|
|
574
|
-
}, {
|
|
575
|
-
s: 'Windows Vista',
|
|
576
|
-
r: /Windows NT 6.0/
|
|
577
|
-
}, {
|
|
578
|
-
s: 'Windows Server 2003',
|
|
579
|
-
r: /Windows NT 5.2/
|
|
580
|
-
}, {
|
|
581
|
-
s: 'Windows XP',
|
|
582
|
-
r: /(Windows NT 5.1|Windows XP)/
|
|
583
|
-
}, {
|
|
584
|
-
s: 'Windows 2000',
|
|
585
|
-
r: /(Windows NT 5.0|Windows 2000)/
|
|
586
|
-
}, {
|
|
587
|
-
s: 'Windows ME',
|
|
588
|
-
r: /(Win 9x 4.90|Windows ME)/
|
|
589
|
-
}, {
|
|
590
|
-
s: 'Windows 98',
|
|
591
|
-
r: /(Windows 98|Win98)/
|
|
592
|
-
}, {
|
|
593
|
-
s: 'Windows 95',
|
|
594
|
-
r: /(Windows 95|Win95|Windows_95)/
|
|
595
|
-
}, {
|
|
596
|
-
s: 'Windows NT 4.0',
|
|
597
|
-
r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/
|
|
598
|
-
}, {
|
|
599
|
-
s: 'Windows CE',
|
|
600
|
-
r: /Windows CE/
|
|
601
|
-
}, {
|
|
602
|
-
s: 'Windows 3.11',
|
|
603
|
-
r: /Win16/
|
|
604
|
-
}, {
|
|
605
|
-
s: 'Android',
|
|
606
|
-
r: /Android/
|
|
607
|
-
}, {
|
|
608
|
-
s: 'Open BSD',
|
|
609
|
-
r: /OpenBSD/
|
|
610
|
-
}, {
|
|
611
|
-
s: 'Sun OS',
|
|
612
|
-
r: /SunOS/
|
|
613
|
-
}, {
|
|
614
|
-
s: 'Linux',
|
|
615
|
-
r: /(Linux|X11)/
|
|
616
|
-
}, {
|
|
617
|
-
s: 'iOS',
|
|
618
|
-
r: /(iPhone|iPad|iPod)/
|
|
619
|
-
}, {
|
|
620
|
-
s: 'Mac OS X',
|
|
621
|
-
r: /Mac OS X/
|
|
622
|
-
}, {
|
|
623
|
-
s: 'Mac OS',
|
|
624
|
-
r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/
|
|
625
|
-
}, {
|
|
626
|
-
s: 'QNX',
|
|
627
|
-
r: /QNX/
|
|
628
|
-
}, {
|
|
629
|
-
s: 'UNIX',
|
|
630
|
-
r: /UNIX/
|
|
631
|
-
}, {
|
|
632
|
-
s: 'BeOS',
|
|
633
|
-
r: /BeOS/
|
|
634
|
-
}, {
|
|
635
|
-
s: 'OS/2',
|
|
636
|
-
r: /OS\/2/
|
|
637
|
-
}, {
|
|
638
|
-
s: 'Search Bot',
|
|
639
|
-
r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
|
|
640
|
-
}];
|
|
641
|
-
for (var i = 0, cs; cs = clientStrings[i]; i++) {
|
|
642
|
-
if (cs.r.test(nAgt)) {
|
|
643
|
-
os = cs.s;
|
|
644
|
-
break;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
var osVersion = unknown;
|
|
648
|
-
if (/Windows/.test(os)) {
|
|
649
|
-
if (/Windows (.*)/.test(os)) {
|
|
650
|
-
osVersion = /Windows (.*)/.exec(os)[1];
|
|
651
|
-
}
|
|
652
|
-
os = 'Windows';
|
|
653
|
-
}
|
|
654
|
-
switch (os) {
|
|
655
|
-
case 'Mac OS X':
|
|
656
|
-
if (/Mac OS X (10[\.\_\d]+)/.test(nAgt)) {
|
|
657
|
-
osVersion = /Mac OS X (10[\.\_\d]+)/.exec(nAgt)[1];
|
|
658
|
-
}
|
|
659
|
-
break;
|
|
660
|
-
case 'Android':
|
|
661
|
-
if (/Android ([\.\_\d]+)/.test(nAgt)) {
|
|
662
|
-
osVersion = /Android ([\.\_\d]+)/.exec(nAgt)[1];
|
|
663
|
-
}
|
|
664
|
-
break;
|
|
665
|
-
case 'iOS':
|
|
666
|
-
if (/OS (\d+)_(\d+)_?(\d+)?/.test(nAgt)) {
|
|
667
|
-
osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVer);
|
|
668
|
-
if (osVersion && osVersion.length > 3) {
|
|
669
|
-
osVersion = osVersion[1] + '.' + osVersion[2] + '.' + (osVersion[3] | 0);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
break;
|
|
673
|
-
}
|
|
674
|
-
return {
|
|
675
|
-
osName: os,
|
|
676
|
-
osVersion: osVersion
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
var osName = 'Unknown OS';
|
|
680
|
-
var osVersion = 'Unknown OS Version';
|
|
681
|
-
function getAndroidVersion(ua) {
|
|
682
|
-
ua = (ua || navigator.userAgent).toLowerCase();
|
|
683
|
-
var match = ua.match(/android\s([0-9\.]*)/);
|
|
684
|
-
return match ? match[1] : false;
|
|
685
|
-
}
|
|
686
|
-
var osInfo = detectDesktopOS();
|
|
687
|
-
if (osInfo && osInfo.osName && osInfo.osName != '-') {
|
|
688
|
-
osName = osInfo.osName;
|
|
689
|
-
osVersion = osInfo.osVersion;
|
|
690
|
-
} else if (isMobile.any()) {
|
|
691
|
-
osName = isMobile.getOsName();
|
|
692
|
-
if (osName == 'Android') {
|
|
693
|
-
osVersion = getAndroidVersion();
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
var isNodejs = typeof browser$1 === 'object' && typeof browser$1.versions === 'object' && browser$1.versions.node;
|
|
697
|
-
if (osName === 'Unknown OS' && isNodejs) {
|
|
698
|
-
osName = 'Nodejs';
|
|
699
|
-
osVersion = browser$1.versions.node.toString().replace('v', '');
|
|
700
|
-
}
|
|
701
|
-
var isCanvasSupportsStreamCapturing = false;
|
|
702
|
-
var isVideoSupportsStreamCapturing = false;
|
|
703
|
-
['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function (item) {
|
|
704
|
-
if (typeof document === 'undefined' || typeof document.createElement !== 'function') {
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
if (!isCanvasSupportsStreamCapturing && item in document.createElement('canvas')) {
|
|
708
|
-
isCanvasSupportsStreamCapturing = true;
|
|
709
|
-
}
|
|
710
|
-
if (!isVideoSupportsStreamCapturing && item in document.createElement('video')) {
|
|
711
|
-
isVideoSupportsStreamCapturing = true;
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
var regexIpv4Local = /^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/,
|
|
715
|
-
regexIpv4 = /([0-9]{1,3}(\.[0-9]{1,3}){3})/,
|
|
716
|
-
regexIpv6 = /[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}/;
|
|
717
|
-
|
|
718
|
-
// via: https://github.com/diafygi/webrtc-ips
|
|
719
|
-
function DetectLocalIPAddress(callback, stream) {
|
|
720
|
-
if (!DetectRTC.isWebRTCSupported) {
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
var isPublic = true,
|
|
724
|
-
isIpv4 = true;
|
|
725
|
-
getIPs(function (ip) {
|
|
726
|
-
if (!ip) {
|
|
727
|
-
callback(); // Pass nothing to tell that ICE-gathering-ended
|
|
728
|
-
} else if (ip.match(regexIpv4Local)) {
|
|
729
|
-
isPublic = false;
|
|
730
|
-
callback('Local: ' + ip, isPublic, isIpv4);
|
|
731
|
-
} else if (ip.match(regexIpv6)) {
|
|
732
|
-
//via https://ourcodeworld.com/articles/read/257/how-to-get-the-client-ip-address-with-javascript-only
|
|
733
|
-
isIpv4 = false;
|
|
734
|
-
callback('Public: ' + ip, isPublic, isIpv4);
|
|
735
|
-
} else {
|
|
736
|
-
callback('Public: ' + ip, isPublic, isIpv4);
|
|
737
|
-
}
|
|
738
|
-
}, stream);
|
|
739
|
-
}
|
|
740
|
-
function getIPs(callback, stream) {
|
|
741
|
-
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') {
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
var ipDuplicates = {};
|
|
745
|
-
var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
|
|
746
|
-
if (!RTCPeerConnection) {
|
|
747
|
-
var iframe = document.getElementById('iframe');
|
|
748
|
-
if (!iframe) {
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
var win = iframe.contentWindow;
|
|
752
|
-
RTCPeerConnection = win.RTCPeerConnection || win.mozRTCPeerConnection || win.webkitRTCPeerConnection;
|
|
753
|
-
}
|
|
754
|
-
if (!RTCPeerConnection) {
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
var peerConfig = null;
|
|
758
|
-
if (DetectRTC.browser === 'Chrome' && DetectRTC.browser.version < 58) {
|
|
759
|
-
// todo: add support for older Opera
|
|
760
|
-
peerConfig = {
|
|
761
|
-
optional: [{
|
|
762
|
-
RtpDataChannels: true
|
|
763
|
-
}]
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
var servers = {
|
|
767
|
-
iceServers: [{
|
|
768
|
-
urls: 'stun:stun.l.google.com:19302'
|
|
769
|
-
}]
|
|
770
|
-
};
|
|
771
|
-
var pc = new RTCPeerConnection(servers, peerConfig);
|
|
772
|
-
if (stream) {
|
|
773
|
-
if (pc.addStream) {
|
|
774
|
-
pc.addStream(stream);
|
|
775
|
-
} else if (pc.addTrack && stream.getTracks()[0]) {
|
|
776
|
-
pc.addTrack(stream.getTracks()[0], stream);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
function handleCandidate(candidate) {
|
|
780
|
-
if (!candidate) {
|
|
781
|
-
callback(); // Pass nothing to tell that ICE-gathering-ended
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
|
-
var match = regexIpv4.exec(candidate);
|
|
785
|
-
if (!match) {
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
var ipAddress = match[1];
|
|
789
|
-
var isPublic = candidate.match(regexIpv4Local),
|
|
790
|
-
isIpv4 = true;
|
|
791
|
-
if (ipDuplicates[ipAddress] === undefined) {
|
|
792
|
-
callback(ipAddress, isPublic, isIpv4);
|
|
793
|
-
}
|
|
794
|
-
ipDuplicates[ipAddress] = true;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
// listen for candidate events
|
|
798
|
-
pc.onicecandidate = function (event) {
|
|
799
|
-
if (event.candidate && event.candidate.candidate) {
|
|
800
|
-
handleCandidate(event.candidate.candidate);
|
|
801
|
-
} else {
|
|
802
|
-
handleCandidate(); // Pass nothing to tell that ICE-gathering-ended
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
|
|
806
|
-
// create data channel
|
|
807
|
-
if (!stream) {
|
|
808
|
-
try {
|
|
809
|
-
pc.createDataChannel('sctp', {});
|
|
810
|
-
} catch (e) {}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// create an offer sdp
|
|
814
|
-
if (DetectRTC.isPromisesSupported) {
|
|
815
|
-
pc.createOffer().then(function (result) {
|
|
816
|
-
pc.setLocalDescription(result).then(afterCreateOffer);
|
|
817
|
-
});
|
|
818
|
-
} else {
|
|
819
|
-
pc.createOffer(function (result) {
|
|
820
|
-
pc.setLocalDescription(result, afterCreateOffer, function () {});
|
|
821
|
-
}, function () {});
|
|
822
|
-
}
|
|
823
|
-
function afterCreateOffer() {
|
|
824
|
-
var lines = pc.localDescription.sdp.split('\n');
|
|
825
|
-
lines.forEach(function (line) {
|
|
826
|
-
if (line && line.indexOf('a=candidate:') === 0) {
|
|
827
|
-
handleCandidate(line);
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
var MediaDevices = [];
|
|
833
|
-
var audioInputDevices = [];
|
|
834
|
-
var audioOutputDevices = [];
|
|
835
|
-
var videoInputDevices = [];
|
|
836
|
-
if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
|
|
837
|
-
// Firefox 38+ seems having support of enumerateDevices
|
|
838
|
-
// Thanks @xdumaine/enumerateDevices
|
|
839
|
-
navigator.enumerateDevices = function (callback) {
|
|
840
|
-
var enumerateDevices = navigator.mediaDevices.enumerateDevices();
|
|
841
|
-
if (enumerateDevices && enumerateDevices.then) {
|
|
842
|
-
navigator.mediaDevices.enumerateDevices().then(callback).catch(function () {
|
|
843
|
-
callback([]);
|
|
844
|
-
});
|
|
845
|
-
} else {
|
|
846
|
-
callback([]);
|
|
847
|
-
}
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
// Media Devices detection
|
|
852
|
-
var canEnumerate = false;
|
|
853
|
-
|
|
854
|
-
/*global MediaStreamTrack:true */
|
|
855
|
-
if (typeof MediaStreamTrack !== 'undefined' && 'getSources' in MediaStreamTrack) {
|
|
856
|
-
canEnumerate = true;
|
|
857
|
-
} else if (navigator.mediaDevices && !!navigator.mediaDevices.enumerateDevices) {
|
|
858
|
-
canEnumerate = true;
|
|
859
|
-
}
|
|
860
|
-
var hasMicrophone = false;
|
|
861
|
-
var hasSpeakers = false;
|
|
862
|
-
var hasWebcam = false;
|
|
863
|
-
var isWebsiteHasMicrophonePermissions = false;
|
|
864
|
-
var isWebsiteHasWebcamPermissions = false;
|
|
865
|
-
|
|
866
|
-
// http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediadevices
|
|
867
|
-
function checkDeviceSupport(callback) {
|
|
868
|
-
if (!canEnumerate) {
|
|
869
|
-
if (callback) {
|
|
870
|
-
callback();
|
|
871
|
-
}
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
|
|
875
|
-
navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
|
|
876
|
-
}
|
|
877
|
-
if (!navigator.enumerateDevices && navigator.enumerateDevices) {
|
|
878
|
-
navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator);
|
|
879
|
-
}
|
|
880
|
-
if (!navigator.enumerateDevices) {
|
|
881
|
-
if (callback) {
|
|
882
|
-
callback();
|
|
883
|
-
}
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
MediaDevices = [];
|
|
887
|
-
audioInputDevices = [];
|
|
888
|
-
audioOutputDevices = [];
|
|
889
|
-
videoInputDevices = [];
|
|
890
|
-
hasMicrophone = false;
|
|
891
|
-
hasSpeakers = false;
|
|
892
|
-
hasWebcam = false;
|
|
893
|
-
isWebsiteHasMicrophonePermissions = false;
|
|
894
|
-
isWebsiteHasWebcamPermissions = false;
|
|
895
|
-
|
|
896
|
-
// to prevent duplication
|
|
897
|
-
var alreadyUsedDevices = {};
|
|
898
|
-
navigator.enumerateDevices(function (devices) {
|
|
899
|
-
MediaDevices = [];
|
|
900
|
-
audioInputDevices = [];
|
|
901
|
-
audioOutputDevices = [];
|
|
902
|
-
videoInputDevices = [];
|
|
903
|
-
devices.forEach(function (_device) {
|
|
904
|
-
var device = {};
|
|
905
|
-
for (var d in _device) {
|
|
906
|
-
try {
|
|
907
|
-
if (typeof _device[d] !== 'function') {
|
|
908
|
-
device[d] = _device[d];
|
|
909
|
-
}
|
|
910
|
-
} catch (e) {}
|
|
911
|
-
}
|
|
912
|
-
if (alreadyUsedDevices[device.deviceId + device.label + device.kind]) {
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// if it is MediaStreamTrack.getSources
|
|
917
|
-
if (device.kind === 'audio') {
|
|
918
|
-
device.kind = 'audioinput';
|
|
919
|
-
}
|
|
920
|
-
if (device.kind === 'video') {
|
|
921
|
-
device.kind = 'videoinput';
|
|
922
|
-
}
|
|
923
|
-
if (!device.deviceId) {
|
|
924
|
-
device.deviceId = device.id;
|
|
925
|
-
}
|
|
926
|
-
if (!device.id) {
|
|
927
|
-
device.id = device.deviceId;
|
|
928
|
-
}
|
|
929
|
-
if (!device.label) {
|
|
930
|
-
device.isCustomLabel = true;
|
|
931
|
-
if (device.kind === 'videoinput') {
|
|
932
|
-
device.label = 'Camera ' + (videoInputDevices.length + 1);
|
|
933
|
-
} else if (device.kind === 'audioinput') {
|
|
934
|
-
device.label = 'Microphone ' + (audioInputDevices.length + 1);
|
|
935
|
-
} else if (device.kind === 'audiooutput') {
|
|
936
|
-
device.label = 'Speaker ' + (audioOutputDevices.length + 1);
|
|
937
|
-
} else {
|
|
938
|
-
device.label = 'Please invoke getUserMedia once.';
|
|
939
|
-
}
|
|
940
|
-
if (typeof DetectRTC !== 'undefined' && DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
|
|
941
|
-
if (typeof document !== 'undefined' && typeof document.domain === 'string' && document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
|
|
942
|
-
device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
} else {
|
|
946
|
-
// Firefox on Android still returns empty label
|
|
947
|
-
if (device.kind === 'videoinput' && !isWebsiteHasWebcamPermissions) {
|
|
948
|
-
isWebsiteHasWebcamPermissions = true;
|
|
949
|
-
}
|
|
950
|
-
if (device.kind === 'audioinput' && !isWebsiteHasMicrophonePermissions) {
|
|
951
|
-
isWebsiteHasMicrophonePermissions = true;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
if (device.kind === 'audioinput') {
|
|
955
|
-
hasMicrophone = true;
|
|
956
|
-
if (audioInputDevices.indexOf(device) === -1) {
|
|
957
|
-
audioInputDevices.push(device);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
if (device.kind === 'audiooutput') {
|
|
961
|
-
hasSpeakers = true;
|
|
962
|
-
if (audioOutputDevices.indexOf(device) === -1) {
|
|
963
|
-
audioOutputDevices.push(device);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
if (device.kind === 'videoinput') {
|
|
967
|
-
hasWebcam = true;
|
|
968
|
-
if (videoInputDevices.indexOf(device) === -1) {
|
|
969
|
-
videoInputDevices.push(device);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
// there is no 'videoouput' in the spec.
|
|
974
|
-
MediaDevices.push(device);
|
|
975
|
-
alreadyUsedDevices[device.deviceId + device.label + device.kind] = device;
|
|
976
|
-
});
|
|
977
|
-
if (typeof DetectRTC !== 'undefined') {
|
|
978
|
-
// to sync latest outputs
|
|
979
|
-
DetectRTC.MediaDevices = MediaDevices;
|
|
980
|
-
DetectRTC.hasMicrophone = hasMicrophone;
|
|
981
|
-
DetectRTC.hasSpeakers = hasSpeakers;
|
|
982
|
-
DetectRTC.hasWebcam = hasWebcam;
|
|
983
|
-
DetectRTC.isWebsiteHasWebcamPermissions = isWebsiteHasWebcamPermissions;
|
|
984
|
-
DetectRTC.isWebsiteHasMicrophonePermissions = isWebsiteHasMicrophonePermissions;
|
|
985
|
-
DetectRTC.audioInputDevices = audioInputDevices;
|
|
986
|
-
DetectRTC.audioOutputDevices = audioOutputDevices;
|
|
987
|
-
DetectRTC.videoInputDevices = videoInputDevices;
|
|
988
|
-
}
|
|
989
|
-
if (callback) {
|
|
990
|
-
callback();
|
|
991
|
-
}
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
var DetectRTC = window.DetectRTC || {};
|
|
995
|
-
|
|
996
|
-
// ----------
|
|
997
|
-
// DetectRTC.browser.name || DetectRTC.browser.version || DetectRTC.browser.fullVersion
|
|
998
|
-
DetectRTC.browser = getBrowserInfo();
|
|
999
|
-
detectPrivateMode(function (isPrivateBrowsing) {
|
|
1000
|
-
DetectRTC.browser.isPrivateBrowsing = !!isPrivateBrowsing;
|
|
1001
|
-
});
|
|
1002
|
-
|
|
1003
|
-
// DetectRTC.isChrome || DetectRTC.isFirefox || DetectRTC.isEdge
|
|
1004
|
-
DetectRTC.browser['is' + DetectRTC.browser.name] = true;
|
|
1005
|
-
|
|
1006
|
-
// -----------
|
|
1007
|
-
DetectRTC.osName = osName;
|
|
1008
|
-
DetectRTC.osVersion = osVersion;
|
|
1009
|
-
typeof browser$1 === 'object' && typeof browser$1.versions === 'object' && browser$1.versions['node-webkit'];
|
|
1010
|
-
|
|
1011
|
-
// --------- Detect if system supports WebRTC 1.0 or WebRTC 1.1.
|
|
1012
|
-
var isWebRTCSupported = false;
|
|
1013
|
-
['RTCPeerConnection', 'webkitRTCPeerConnection', 'mozRTCPeerConnection', 'RTCIceGatherer'].forEach(function (item) {
|
|
1014
|
-
if (isWebRTCSupported) {
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
if (item in window) {
|
|
1018
|
-
isWebRTCSupported = true;
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1021
|
-
DetectRTC.isWebRTCSupported = isWebRTCSupported;
|
|
1022
|
-
|
|
1023
|
-
//-------
|
|
1024
|
-
DetectRTC.isORTCSupported = typeof RTCIceGatherer !== 'undefined';
|
|
1025
|
-
|
|
1026
|
-
// --------- Detect if system supports screen capturing API
|
|
1027
|
-
var isScreenCapturingSupported = false;
|
|
1028
|
-
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 35) {
|
|
1029
|
-
isScreenCapturingSupported = true;
|
|
1030
|
-
} else if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 34) {
|
|
1031
|
-
isScreenCapturingSupported = true;
|
|
1032
|
-
} else if (DetectRTC.browser.isEdge && DetectRTC.browser.version >= 17) {
|
|
1033
|
-
isScreenCapturingSupported = true;
|
|
1034
|
-
} else if (DetectRTC.osName === 'Android' && DetectRTC.browser.isChrome) {
|
|
1035
|
-
isScreenCapturingSupported = true;
|
|
1036
|
-
}
|
|
1037
|
-
if (!!navigator.getDisplayMedia || navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
|
|
1038
|
-
isScreenCapturingSupported = true;
|
|
1039
|
-
}
|
|
1040
|
-
if (!/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
|
|
1041
|
-
var isNonLocalHost = typeof document !== 'undefined' && typeof document.domain === 'string' && document.domain.search && document.domain.search(/localhost|127.0./g) === -1;
|
|
1042
|
-
if (isNonLocalHost && (DetectRTC.browser.isChrome || DetectRTC.browser.isEdge || DetectRTC.browser.isOpera)) {
|
|
1043
|
-
isScreenCapturingSupported = false;
|
|
1044
|
-
} else if (DetectRTC.browser.isFirefox) {
|
|
1045
|
-
isScreenCapturingSupported = false;
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
DetectRTC.isScreenCapturingSupported = isScreenCapturingSupported;
|
|
1049
|
-
|
|
1050
|
-
// --------- Detect if WebAudio API are supported
|
|
1051
|
-
var webAudio = {
|
|
1052
|
-
isSupported: false,
|
|
1053
|
-
isCreateMediaStreamSourceSupported: false
|
|
1054
|
-
};
|
|
1055
|
-
['AudioContext', 'webkitAudioContext', 'mozAudioContext', 'msAudioContext'].forEach(function (item) {
|
|
1056
|
-
if (webAudio.isSupported) {
|
|
1057
|
-
return;
|
|
1058
|
-
}
|
|
1059
|
-
if (item in window) {
|
|
1060
|
-
webAudio.isSupported = true;
|
|
1061
|
-
if (window[item] && 'createMediaStreamSource' in window[item].prototype) {
|
|
1062
|
-
webAudio.isCreateMediaStreamSourceSupported = true;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
DetectRTC.isAudioContextSupported = webAudio.isSupported;
|
|
1067
|
-
DetectRTC.isCreateMediaStreamSourceSupported = webAudio.isCreateMediaStreamSourceSupported;
|
|
1068
|
-
|
|
1069
|
-
// ---------- Detect if SCTP/RTP channels are supported.
|
|
1070
|
-
|
|
1071
|
-
var isRtpDataChannelsSupported = false;
|
|
1072
|
-
if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 31) {
|
|
1073
|
-
isRtpDataChannelsSupported = true;
|
|
1074
|
-
}
|
|
1075
|
-
DetectRTC.isRtpDataChannelsSupported = isRtpDataChannelsSupported;
|
|
1076
|
-
var isSCTPSupportd = false;
|
|
1077
|
-
if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 28) {
|
|
1078
|
-
isSCTPSupportd = true;
|
|
1079
|
-
} else if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 25) {
|
|
1080
|
-
isSCTPSupportd = true;
|
|
1081
|
-
} else if (DetectRTC.browser.isOpera && DetectRTC.browser.version >= 11) {
|
|
1082
|
-
isSCTPSupportd = true;
|
|
1083
|
-
}
|
|
1084
|
-
DetectRTC.isSctpDataChannelsSupported = isSCTPSupportd;
|
|
1085
|
-
|
|
1086
|
-
// ---------
|
|
1087
|
-
|
|
1088
|
-
DetectRTC.isMobileDevice = isMobileDevice; // "isMobileDevice" boolean is defined in "getBrowserInfo.js"
|
|
1089
|
-
|
|
1090
|
-
// ------
|
|
1091
|
-
var isGetUserMediaSupported = false;
|
|
1092
|
-
if (navigator.getUserMedia) {
|
|
1093
|
-
isGetUserMediaSupported = true;
|
|
1094
|
-
} else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
1095
|
-
isGetUserMediaSupported = true;
|
|
1096
|
-
}
|
|
1097
|
-
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
|
|
1098
|
-
if (typeof document !== 'undefined' && typeof document.domain === 'string' && document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
|
|
1099
|
-
isGetUserMediaSupported = 'Requires HTTPs';
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
if (DetectRTC.osName === 'Nodejs') {
|
|
1103
|
-
isGetUserMediaSupported = false;
|
|
1104
|
-
}
|
|
1105
|
-
DetectRTC.isGetUserMediaSupported = isGetUserMediaSupported;
|
|
1106
|
-
var displayResolution = '';
|
|
1107
|
-
if (screen.width) {
|
|
1108
|
-
var width = screen.width ? screen.width : '';
|
|
1109
|
-
var height = screen.height ? screen.height : '';
|
|
1110
|
-
displayResolution += '' + width + ' x ' + height;
|
|
1111
|
-
}
|
|
1112
|
-
DetectRTC.displayResolution = displayResolution;
|
|
1113
|
-
function getAspectRatio(w, h) {
|
|
1114
|
-
function gcd(a, b) {
|
|
1115
|
-
return b == 0 ? a : gcd(b, a % b);
|
|
1116
|
-
}
|
|
1117
|
-
var r = gcd(w, h);
|
|
1118
|
-
return w / r / (h / r);
|
|
1119
|
-
}
|
|
1120
|
-
DetectRTC.displayAspectRatio = getAspectRatio(screen.width, screen.height).toFixed(2);
|
|
1121
|
-
|
|
1122
|
-
// ----------
|
|
1123
|
-
DetectRTC.isCanvasSupportsStreamCapturing = isCanvasSupportsStreamCapturing;
|
|
1124
|
-
DetectRTC.isVideoSupportsStreamCapturing = isVideoSupportsStreamCapturing;
|
|
1125
|
-
if (DetectRTC.browser.name == 'Chrome' && DetectRTC.browser.version >= 53) {
|
|
1126
|
-
if (!DetectRTC.isCanvasSupportsStreamCapturing) {
|
|
1127
|
-
DetectRTC.isCanvasSupportsStreamCapturing = 'Requires chrome flag: enable-experimental-web-platform-features';
|
|
1128
|
-
}
|
|
1129
|
-
if (!DetectRTC.isVideoSupportsStreamCapturing) {
|
|
1130
|
-
DetectRTC.isVideoSupportsStreamCapturing = 'Requires chrome flag: enable-experimental-web-platform-features';
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
// ------
|
|
1135
|
-
DetectRTC.DetectLocalIPAddress = DetectLocalIPAddress;
|
|
1136
|
-
DetectRTC.isWebSocketsSupported = 'WebSocket' in window && 2 === window.WebSocket.CLOSING;
|
|
1137
|
-
DetectRTC.isWebSocketsBlocked = !DetectRTC.isWebSocketsSupported;
|
|
1138
|
-
if (DetectRTC.osName === 'Nodejs') {
|
|
1139
|
-
DetectRTC.isWebSocketsSupported = true;
|
|
1140
|
-
DetectRTC.isWebSocketsBlocked = false;
|
|
1141
|
-
}
|
|
1142
|
-
DetectRTC.checkWebSocketsSupport = function (callback) {
|
|
1143
|
-
callback = callback || function () {};
|
|
1144
|
-
try {
|
|
1145
|
-
var starttime;
|
|
1146
|
-
var websocket = new WebSocket('wss://echo.websocket.org:443/');
|
|
1147
|
-
websocket.onopen = function () {
|
|
1148
|
-
DetectRTC.isWebSocketsBlocked = false;
|
|
1149
|
-
starttime = new Date().getTime();
|
|
1150
|
-
websocket.send('ping');
|
|
1151
|
-
};
|
|
1152
|
-
websocket.onmessage = function () {
|
|
1153
|
-
DetectRTC.WebsocketLatency = new Date().getTime() - starttime + 'ms';
|
|
1154
|
-
callback();
|
|
1155
|
-
websocket.close();
|
|
1156
|
-
websocket = null;
|
|
1157
|
-
};
|
|
1158
|
-
websocket.onerror = function () {
|
|
1159
|
-
DetectRTC.isWebSocketsBlocked = true;
|
|
1160
|
-
callback();
|
|
1161
|
-
};
|
|
1162
|
-
} catch (e) {
|
|
1163
|
-
DetectRTC.isWebSocketsBlocked = true;
|
|
1164
|
-
callback();
|
|
1165
|
-
}
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
// -------
|
|
1169
|
-
DetectRTC.load = function (callback) {
|
|
1170
|
-
callback = callback || function () {};
|
|
1171
|
-
checkDeviceSupport(callback);
|
|
1172
|
-
};
|
|
1173
|
-
if (typeof MediaDevices !== 'undefined') {
|
|
1174
|
-
DetectRTC.MediaDevices = MediaDevices;
|
|
1175
|
-
} else {
|
|
1176
|
-
DetectRTC.MediaDevices = [];
|
|
1177
|
-
}
|
|
1178
|
-
DetectRTC.hasMicrophone = hasMicrophone;
|
|
1179
|
-
DetectRTC.hasSpeakers = hasSpeakers;
|
|
1180
|
-
DetectRTC.hasWebcam = hasWebcam;
|
|
1181
|
-
DetectRTC.isWebsiteHasWebcamPermissions = isWebsiteHasWebcamPermissions;
|
|
1182
|
-
DetectRTC.isWebsiteHasMicrophonePermissions = isWebsiteHasMicrophonePermissions;
|
|
1183
|
-
DetectRTC.audioInputDevices = audioInputDevices;
|
|
1184
|
-
DetectRTC.audioOutputDevices = audioOutputDevices;
|
|
1185
|
-
DetectRTC.videoInputDevices = videoInputDevices;
|
|
1186
|
-
|
|
1187
|
-
// ------
|
|
1188
|
-
var isSetSinkIdSupported = false;
|
|
1189
|
-
if (typeof document !== 'undefined' && typeof document.createElement === 'function' && 'setSinkId' in document.createElement('video')) {
|
|
1190
|
-
isSetSinkIdSupported = true;
|
|
1191
|
-
}
|
|
1192
|
-
DetectRTC.isSetSinkIdSupported = isSetSinkIdSupported;
|
|
1193
|
-
|
|
1194
|
-
// -----
|
|
1195
|
-
var isRTPSenderReplaceTracksSupported = false;
|
|
1196
|
-
if (DetectRTC.browser.isFirefox && typeof mozRTCPeerConnection !== 'undefined' /*&& DetectRTC.browser.version > 39*/) {
|
|
1197
|
-
/*global mozRTCPeerConnection:true */
|
|
1198
|
-
if ('getSenders' in mozRTCPeerConnection.prototype) {
|
|
1199
|
-
isRTPSenderReplaceTracksSupported = true;
|
|
1200
|
-
}
|
|
1201
|
-
} else if (DetectRTC.browser.isChrome && typeof webkitRTCPeerConnection !== 'undefined') {
|
|
1202
|
-
/*global webkitRTCPeerConnection:true */
|
|
1203
|
-
if ('getSenders' in webkitRTCPeerConnection.prototype) {
|
|
1204
|
-
isRTPSenderReplaceTracksSupported = true;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
DetectRTC.isRTPSenderReplaceTracksSupported = isRTPSenderReplaceTracksSupported;
|
|
1208
|
-
|
|
1209
|
-
//------
|
|
1210
|
-
var isRemoteStreamProcessingSupported = false;
|
|
1211
|
-
if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 38) {
|
|
1212
|
-
isRemoteStreamProcessingSupported = true;
|
|
1213
|
-
}
|
|
1214
|
-
DetectRTC.isRemoteStreamProcessingSupported = isRemoteStreamProcessingSupported;
|
|
1215
|
-
|
|
1216
|
-
//-------
|
|
1217
|
-
var isApplyConstraintsSupported = false;
|
|
1218
|
-
|
|
1219
|
-
/*global MediaStreamTrack:true */
|
|
1220
|
-
if (typeof MediaStreamTrack !== 'undefined' && 'applyConstraints' in MediaStreamTrack.prototype) {
|
|
1221
|
-
isApplyConstraintsSupported = true;
|
|
1222
|
-
}
|
|
1223
|
-
DetectRTC.isApplyConstraintsSupported = isApplyConstraintsSupported;
|
|
1224
|
-
|
|
1225
|
-
//-------
|
|
1226
|
-
var isMultiMonitorScreenCapturingSupported = false;
|
|
1227
|
-
if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 43) {
|
|
1228
|
-
// version 43 merely supports platforms for multi-monitors
|
|
1229
|
-
// version 44 will support exact multi-monitor selection i.e. you can select any monitor for screen capturing.
|
|
1230
|
-
isMultiMonitorScreenCapturingSupported = true;
|
|
1231
|
-
}
|
|
1232
|
-
DetectRTC.isMultiMonitorScreenCapturingSupported = isMultiMonitorScreenCapturingSupported;
|
|
1233
|
-
DetectRTC.isPromisesSupported = !!('Promise' in window);
|
|
1234
|
-
|
|
1235
|
-
// version is generated by "grunt"
|
|
1236
|
-
DetectRTC.version = '1.4.1';
|
|
1237
|
-
if (typeof DetectRTC === 'undefined') {
|
|
1238
|
-
window.DetectRTC = {};
|
|
1239
|
-
}
|
|
1240
|
-
var MediaStream = window.MediaStream;
|
|
1241
|
-
if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {
|
|
1242
|
-
MediaStream = webkitMediaStream;
|
|
1243
|
-
}
|
|
1244
|
-
if (typeof MediaStream !== 'undefined' && typeof MediaStream === 'function') {
|
|
1245
|
-
DetectRTC.MediaStream = Object.keys(MediaStream.prototype);
|
|
1246
|
-
} else DetectRTC.MediaStream = false;
|
|
1247
|
-
if (typeof MediaStreamTrack !== 'undefined') {
|
|
1248
|
-
DetectRTC.MediaStreamTrack = Object.keys(MediaStreamTrack.prototype);
|
|
1249
|
-
} else DetectRTC.MediaStreamTrack = false;
|
|
1250
|
-
var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
|
|
1251
|
-
if (typeof RTCPeerConnection !== 'undefined') {
|
|
1252
|
-
DetectRTC.RTCPeerConnection = Object.keys(RTCPeerConnection.prototype);
|
|
1253
|
-
} else DetectRTC.RTCPeerConnection = false;
|
|
1254
|
-
window.DetectRTC = DetectRTC;
|
|
1255
|
-
{
|
|
1256
|
-
module.exports = DetectRTC;
|
|
1257
|
-
}
|
|
1258
|
-
})();
|
|
1259
|
-
})(DetectRTC);
|
|
1260
|
-
|
|
1261
|
-
var MEDIA = 'MEDIA';
|
|
1262
|
-
var DEVICE = 'DEVICE';
|
|
1263
|
-
var MEDIA_STREAM_TRACK = 'MEDIA_STREAM_TRACK';
|
|
1264
|
-
|
|
1265
|
-
var LEVELS = {
|
|
1266
|
-
error: 1,
|
|
1267
|
-
warn: 2,
|
|
1268
|
-
info: 3,
|
|
1269
|
-
debug: 4
|
|
1270
|
-
};
|
|
1271
|
-
var logFormat = (level, logDetails) => {
|
|
1272
|
-
var {
|
|
1273
|
-
ID,
|
|
1274
|
-
mediaType,
|
|
1275
|
-
action,
|
|
1276
|
-
description,
|
|
1277
|
-
error
|
|
1278
|
-
} = logDetails;
|
|
1279
|
-
var timestamp = new Date().toISOString();
|
|
1280
|
-
var errorText = error ? error.stack ? "".concat(error.message, ": ").concat(error.stack) : "".concat(error) : '';
|
|
1281
|
-
return "".concat(timestamp, " ").concat(level, " ").concat(ID || '', " ").concat(mediaType, " ").concat(action, " ").concat(description, " ").concat(errorText).replace(/\s+/g, ' ').trim();
|
|
1282
|
-
};
|
|
1283
|
-
var currentLevel = 'error';
|
|
1284
|
-
var log$3 = (level, args) => {
|
|
1285
|
-
if (LEVELS[level] <= LEVELS[currentLevel]) {
|
|
1286
|
-
console.log(logFormat(level, args));
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
var logger$4 = {
|
|
1290
|
-
info: args => log$3('info', args),
|
|
1291
|
-
warn: args => log$3('warn', args),
|
|
1292
|
-
error: args => log$3('error', args),
|
|
1293
|
-
debug: args => log$3('debug', args)
|
|
1294
|
-
};
|
|
1295
|
-
var _loop = function _loop(level) {
|
|
1296
|
-
logger$4[level] = logInfo => {
|
|
1297
|
-
var {
|
|
1298
|
-
ID,
|
|
1299
|
-
mediaType,
|
|
1300
|
-
action,
|
|
1301
|
-
description,
|
|
1302
|
-
error
|
|
1303
|
-
} = logInfo;
|
|
1304
|
-
currentLevel = level;
|
|
1305
|
-
return log$3(level, {
|
|
1306
|
-
ID,
|
|
1307
|
-
mediaType,
|
|
1308
|
-
action,
|
|
1309
|
-
description,
|
|
1310
|
-
error
|
|
1311
|
-
});
|
|
1312
|
-
};
|
|
1313
|
-
};
|
|
1314
|
-
for (var level of ['info', 'warn', 'error', 'debug']) {
|
|
1315
|
-
_loop(level);
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
21
|
var domain;
|
|
1319
22
|
|
|
1320
23
|
// This constructor is used to store event handlers. Instantiating this is
|
|
@@ -1787,6 +490,63 @@ function unwrapListeners$3(arr) {
|
|
|
1787
490
|
return ret;
|
|
1788
491
|
}
|
|
1789
492
|
|
|
493
|
+
var MEDIA = 'MEDIA';
|
|
494
|
+
var DEVICE = 'DEVICE';
|
|
495
|
+
var MEDIA_STREAM_TRACK = 'MEDIA_STREAM_TRACK';
|
|
496
|
+
|
|
497
|
+
var LEVELS = {
|
|
498
|
+
error: 1,
|
|
499
|
+
warn: 2,
|
|
500
|
+
info: 3,
|
|
501
|
+
debug: 4
|
|
502
|
+
};
|
|
503
|
+
var logFormat = (level, logDetails) => {
|
|
504
|
+
var {
|
|
505
|
+
ID,
|
|
506
|
+
mediaType,
|
|
507
|
+
action,
|
|
508
|
+
description,
|
|
509
|
+
error
|
|
510
|
+
} = logDetails;
|
|
511
|
+
var timestamp = new Date().toISOString();
|
|
512
|
+
var errorText = error ? error.stack ? "".concat(error.message, ": ").concat(error.stack) : "".concat(error) : '';
|
|
513
|
+
return "".concat(timestamp, " ").concat(level, " ").concat(ID || '', " ").concat(mediaType, " ").concat(action, " ").concat(description, " ").concat(errorText).replace(/\s+/g, ' ').trim();
|
|
514
|
+
};
|
|
515
|
+
var currentLevel = 'error';
|
|
516
|
+
var log$3 = (level, args) => {
|
|
517
|
+
if (LEVELS[level] <= LEVELS[currentLevel]) {
|
|
518
|
+
console.log(logFormat(level, args));
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
var logger$4 = {
|
|
522
|
+
info: args => log$3('info', args),
|
|
523
|
+
warn: args => log$3('warn', args),
|
|
524
|
+
error: args => log$3('error', args),
|
|
525
|
+
debug: args => log$3('debug', args)
|
|
526
|
+
};
|
|
527
|
+
var _loop = function _loop(level) {
|
|
528
|
+
logger$4[level] = logInfo => {
|
|
529
|
+
var {
|
|
530
|
+
ID,
|
|
531
|
+
mediaType,
|
|
532
|
+
action,
|
|
533
|
+
description,
|
|
534
|
+
error
|
|
535
|
+
} = logInfo;
|
|
536
|
+
currentLevel = level;
|
|
537
|
+
return log$3(level, {
|
|
538
|
+
ID,
|
|
539
|
+
mediaType,
|
|
540
|
+
action,
|
|
541
|
+
description,
|
|
542
|
+
error
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
for (var level of ['info', 'warn', 'error', 'debug']) {
|
|
547
|
+
_loop(level);
|
|
548
|
+
}
|
|
549
|
+
|
|
1790
550
|
function _classPrivateFieldInitSpec$1(obj, privateMap, value) { _checkPrivateRedeclaration$1(obj, privateMap); privateMap.set(obj, value); }
|
|
1791
551
|
function _checkPrivateRedeclaration$1(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
1792
552
|
var DeviceKinds;
|
|
@@ -2366,7 +1126,7 @@ function _deviceChangePublisher() {
|
|
|
2366
1126
|
});
|
|
2367
1127
|
return _deviceChangePublisher.apply(this, arguments);
|
|
2368
1128
|
}
|
|
2369
|
-
function on(_x4, _x5) {
|
|
1129
|
+
function on$1(_x4, _x5) {
|
|
2370
1130
|
return _on.apply(this, arguments);
|
|
2371
1131
|
}
|
|
2372
1132
|
function _on() {
|
|
@@ -2385,7 +1145,7 @@ function _on() {
|
|
|
2385
1145
|
});
|
|
2386
1146
|
return _on.apply(this, arguments);
|
|
2387
1147
|
}
|
|
2388
|
-
var off = (eventName, listener) => {
|
|
1148
|
+
var off$1 = (eventName, listener) => {
|
|
2389
1149
|
logger$4.debug({
|
|
2390
1150
|
mediaType: MEDIA,
|
|
2391
1151
|
action: 'off()',
|
|
@@ -2680,6 +1440,232 @@ var Error$1 = /*#__PURE__*/Object.freeze({
|
|
|
2680
1440
|
|
|
2681
1441
|
class EventEmitter$5 extends EventEmitter$6 {}
|
|
2682
1442
|
|
|
1443
|
+
var global$1 = (typeof global !== "undefined" ? global :
|
|
1444
|
+
typeof self !== "undefined" ? self :
|
|
1445
|
+
typeof window !== "undefined" ? window : {});
|
|
1446
|
+
|
|
1447
|
+
// shim for using process in browser
|
|
1448
|
+
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
1449
|
+
|
|
1450
|
+
function defaultSetTimout() {
|
|
1451
|
+
throw new Error('setTimeout has not been defined');
|
|
1452
|
+
}
|
|
1453
|
+
function defaultClearTimeout () {
|
|
1454
|
+
throw new Error('clearTimeout has not been defined');
|
|
1455
|
+
}
|
|
1456
|
+
var cachedSetTimeout = defaultSetTimout;
|
|
1457
|
+
var cachedClearTimeout = defaultClearTimeout;
|
|
1458
|
+
if (typeof global$1.setTimeout === 'function') {
|
|
1459
|
+
cachedSetTimeout = setTimeout;
|
|
1460
|
+
}
|
|
1461
|
+
if (typeof global$1.clearTimeout === 'function') {
|
|
1462
|
+
cachedClearTimeout = clearTimeout;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
function runTimeout(fun) {
|
|
1466
|
+
if (cachedSetTimeout === setTimeout) {
|
|
1467
|
+
//normal enviroments in sane situations
|
|
1468
|
+
return setTimeout(fun, 0);
|
|
1469
|
+
}
|
|
1470
|
+
// if setTimeout wasn't available but was latter defined
|
|
1471
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
1472
|
+
cachedSetTimeout = setTimeout;
|
|
1473
|
+
return setTimeout(fun, 0);
|
|
1474
|
+
}
|
|
1475
|
+
try {
|
|
1476
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1477
|
+
return cachedSetTimeout(fun, 0);
|
|
1478
|
+
} catch(e){
|
|
1479
|
+
try {
|
|
1480
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1481
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
1482
|
+
} catch(e){
|
|
1483
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
1484
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
}
|
|
1490
|
+
function runClearTimeout(marker) {
|
|
1491
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
1492
|
+
//normal enviroments in sane situations
|
|
1493
|
+
return clearTimeout(marker);
|
|
1494
|
+
}
|
|
1495
|
+
// if clearTimeout wasn't available but was latter defined
|
|
1496
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
1497
|
+
cachedClearTimeout = clearTimeout;
|
|
1498
|
+
return clearTimeout(marker);
|
|
1499
|
+
}
|
|
1500
|
+
try {
|
|
1501
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1502
|
+
return cachedClearTimeout(marker);
|
|
1503
|
+
} catch (e){
|
|
1504
|
+
try {
|
|
1505
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1506
|
+
return cachedClearTimeout.call(null, marker);
|
|
1507
|
+
} catch (e){
|
|
1508
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
1509
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1510
|
+
return cachedClearTimeout.call(this, marker);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
}
|
|
1517
|
+
var queue$2 = [];
|
|
1518
|
+
var draining = false;
|
|
1519
|
+
var currentQueue;
|
|
1520
|
+
var queueIndex = -1;
|
|
1521
|
+
|
|
1522
|
+
function cleanUpNextTick() {
|
|
1523
|
+
if (!draining || !currentQueue) {
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
draining = false;
|
|
1527
|
+
if (currentQueue.length) {
|
|
1528
|
+
queue$2 = currentQueue.concat(queue$2);
|
|
1529
|
+
} else {
|
|
1530
|
+
queueIndex = -1;
|
|
1531
|
+
}
|
|
1532
|
+
if (queue$2.length) {
|
|
1533
|
+
drainQueue();
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
function drainQueue() {
|
|
1538
|
+
if (draining) {
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
1542
|
+
draining = true;
|
|
1543
|
+
|
|
1544
|
+
var len = queue$2.length;
|
|
1545
|
+
while(len) {
|
|
1546
|
+
currentQueue = queue$2;
|
|
1547
|
+
queue$2 = [];
|
|
1548
|
+
while (++queueIndex < len) {
|
|
1549
|
+
if (currentQueue) {
|
|
1550
|
+
currentQueue[queueIndex].run();
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
queueIndex = -1;
|
|
1554
|
+
len = queue$2.length;
|
|
1555
|
+
}
|
|
1556
|
+
currentQueue = null;
|
|
1557
|
+
draining = false;
|
|
1558
|
+
runClearTimeout(timeout);
|
|
1559
|
+
}
|
|
1560
|
+
function nextTick(fun) {
|
|
1561
|
+
var args = new Array(arguments.length - 1);
|
|
1562
|
+
if (arguments.length > 1) {
|
|
1563
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1564
|
+
args[i - 1] = arguments[i];
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
queue$2.push(new Item(fun, args));
|
|
1568
|
+
if (queue$2.length === 1 && !draining) {
|
|
1569
|
+
runTimeout(drainQueue);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
// v8 likes predictible objects
|
|
1573
|
+
function Item(fun, array) {
|
|
1574
|
+
this.fun = fun;
|
|
1575
|
+
this.array = array;
|
|
1576
|
+
}
|
|
1577
|
+
Item.prototype.run = function () {
|
|
1578
|
+
this.fun.apply(null, this.array);
|
|
1579
|
+
};
|
|
1580
|
+
var title = 'browser';
|
|
1581
|
+
var platform = 'browser';
|
|
1582
|
+
var browser = true;
|
|
1583
|
+
var env = {};
|
|
1584
|
+
var argv = [];
|
|
1585
|
+
var version = ''; // empty string to avoid regexp issues
|
|
1586
|
+
var versions = {};
|
|
1587
|
+
var release = {};
|
|
1588
|
+
var config = {};
|
|
1589
|
+
|
|
1590
|
+
function noop() {}
|
|
1591
|
+
|
|
1592
|
+
var on = noop;
|
|
1593
|
+
var addListener = noop;
|
|
1594
|
+
var once$4 = noop;
|
|
1595
|
+
var off = noop;
|
|
1596
|
+
var removeListener = noop;
|
|
1597
|
+
var removeAllListeners = noop;
|
|
1598
|
+
var emit = noop;
|
|
1599
|
+
|
|
1600
|
+
function binding(name) {
|
|
1601
|
+
throw new Error('process.binding is not supported');
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
function cwd () { return '/' }
|
|
1605
|
+
function chdir (dir) {
|
|
1606
|
+
throw new Error('process.chdir is not supported');
|
|
1607
|
+
}function umask() { return 0; }
|
|
1608
|
+
|
|
1609
|
+
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
1610
|
+
var performance$1 = global$1.performance || {};
|
|
1611
|
+
var performanceNow =
|
|
1612
|
+
performance$1.now ||
|
|
1613
|
+
performance$1.mozNow ||
|
|
1614
|
+
performance$1.msNow ||
|
|
1615
|
+
performance$1.oNow ||
|
|
1616
|
+
performance$1.webkitNow ||
|
|
1617
|
+
function(){ return (new Date()).getTime() };
|
|
1618
|
+
|
|
1619
|
+
// generate timestamp or delta
|
|
1620
|
+
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
1621
|
+
function hrtime(previousTimestamp){
|
|
1622
|
+
var clocktime = performanceNow.call(performance$1)*1e-3;
|
|
1623
|
+
var seconds = Math.floor(clocktime);
|
|
1624
|
+
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
|
1625
|
+
if (previousTimestamp) {
|
|
1626
|
+
seconds = seconds - previousTimestamp[0];
|
|
1627
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
1628
|
+
if (nanoseconds<0) {
|
|
1629
|
+
seconds--;
|
|
1630
|
+
nanoseconds += 1e9;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return [seconds,nanoseconds]
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
var startTime = new Date();
|
|
1637
|
+
function uptime() {
|
|
1638
|
+
var currentTime = new Date();
|
|
1639
|
+
var dif = currentTime - startTime;
|
|
1640
|
+
return dif / 1000;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
var browser$1 = {
|
|
1644
|
+
nextTick: nextTick,
|
|
1645
|
+
title: title,
|
|
1646
|
+
browser: browser,
|
|
1647
|
+
env: env,
|
|
1648
|
+
argv: argv,
|
|
1649
|
+
version: version,
|
|
1650
|
+
versions: versions,
|
|
1651
|
+
on: on,
|
|
1652
|
+
addListener: addListener,
|
|
1653
|
+
once: once$4,
|
|
1654
|
+
off: off,
|
|
1655
|
+
removeListener: removeListener,
|
|
1656
|
+
removeAllListeners: removeAllListeners,
|
|
1657
|
+
emit: emit,
|
|
1658
|
+
binding: binding,
|
|
1659
|
+
cwd: cwd,
|
|
1660
|
+
chdir: chdir,
|
|
1661
|
+
umask: umask,
|
|
1662
|
+
hrtime: hrtime,
|
|
1663
|
+
platform: platform,
|
|
1664
|
+
release: release,
|
|
1665
|
+
config: config,
|
|
1666
|
+
uptime: uptime
|
|
1667
|
+
};
|
|
1668
|
+
|
|
2683
1669
|
function _mergeNamespaces$1(n,m){m.forEach(function(e){e&&typeof e!=='string'&&!Array.isArray(e)&&Object.keys(e).forEach(function(k){if(k!=='default'&&!(k in n)){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function get(){return e[k];}});}});});return Object.freeze(n);}/******************************************************************************
|
|
2684
1670
|
Copyright (c) Microsoft Corporation.
|
|
2685
1671
|
|
|
@@ -16231,18 +15217,6 @@ class MultistreamRoapMediaConnection extends EventEmitter$6 {
|
|
|
16231
15217
|
|
|
16232
15218
|
var Errors = Error$1;
|
|
16233
15219
|
|
|
16234
|
-
function isBrowserSupported() {
|
|
16235
|
-
var isSupported = false;
|
|
16236
|
-
logger$4.info({
|
|
16237
|
-
mediaType: MEDIA,
|
|
16238
|
-
action: 'isBrowserSupported()',
|
|
16239
|
-
description: 'Checking is current browser supported by webrtc'
|
|
16240
|
-
});
|
|
16241
|
-
if ((DetectRTC.exports.browser.isChrome || DetectRTC.exports.browser.isFirefox || DetectRTC.exports.browser.isSafari || DetectRTC.exports.browser.isEdge) && DetectRTC.exports.isWebRTCSupported) {
|
|
16242
|
-
isSupported = true;
|
|
16243
|
-
}
|
|
16244
|
-
return isSupported;
|
|
16245
|
-
}
|
|
16246
15220
|
var Media = {
|
|
16247
15221
|
createAudioTrack: createAudioTrack,
|
|
16248
15222
|
createVideoTrack: createVideoTrack,
|
|
@@ -16250,15 +15224,14 @@ var Media = {
|
|
|
16250
15224
|
getCameras: getCameras,
|
|
16251
15225
|
getMicrophones: getMicrophones,
|
|
16252
15226
|
getSpeakers: getSpeakers,
|
|
16253
|
-
on: on,
|
|
16254
|
-
off: off,
|
|
15227
|
+
on: on$1,
|
|
15228
|
+
off: off$1,
|
|
16255
15229
|
Effects: {
|
|
16256
15230
|
BNR: {
|
|
16257
15231
|
enableBNR: enableBNR,
|
|
16258
15232
|
disableBNR: disableBNR
|
|
16259
15233
|
}
|
|
16260
|
-
}
|
|
16261
|
-
isBrowserSupported
|
|
15234
|
+
}
|
|
16262
15235
|
};
|
|
16263
15236
|
|
|
16264
|
-
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, ErrorType, Errors, Event$1 as Event, H264Codec, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Media, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamRoapMediaConnection, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteStream, RemoteTrackType, RoapMediaConnection, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, configureWcmeLogger, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, createMicrophoneStream, getAudioInputDevices, getAudioOutputDevices, getDevices, getErrorDescription, getLogger, getMediaFamily, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices,
|
|
15237
|
+
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, ErrorType, Errors, Event$1 as Event, H264Codec, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Media, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamRoapMediaConnection, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteStream, RemoteTrackType, RoapMediaConnection, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, configureWcmeLogger, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, createMicrophoneStream, getAudioInputDevices, getAudioOutputDevices, getDevices, getErrorDescription, getLogger, getMediaFamily, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, setLogger, setOnDeviceChangeHandler };
|