@techsee/techsee-media-service 0.7.0 → 0.7.2-alpha.1
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/lib/MediaUtils/Compatibility.d.ts +1 -0
- package/lib/MediaUtils/Compatibility.d.ts.map +1 -1
- package/lib/MediaUtils/Compatibility.js +10 -7
- package/lib/MediaUtils/Compatibility.js.map +1 -1
- package/lib/webrtc-ie-shim.js +338 -490
- package/lib/webrtc-ie-shim.js.map +1 -1
- package/package.json +1 -1
package/lib/webrtc-ie-shim.js
CHANGED
|
@@ -1,60 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4
4
|
|
|
5
5
|
(function (f) {
|
|
6
|
-
if ((typeof exports ===
|
|
6
|
+
if ((typeof exports === "undefined" ? "undefined" : _typeof2(exports)) === "object" && typeof module !== "undefined") {
|
|
7
7
|
module.exports = f();
|
|
8
|
-
} else if (typeof define ===
|
|
8
|
+
} else if (typeof define === "function" && define.amd) {
|
|
9
9
|
define([], f);
|
|
10
10
|
} else {
|
|
11
|
-
var g;
|
|
12
|
-
|
|
13
|
-
if (typeof window !== 'undefined') {
|
|
11
|
+
var g;if (typeof window !== "undefined") {
|
|
14
12
|
g = window;
|
|
15
|
-
} else if (typeof global !==
|
|
13
|
+
} else if (typeof global !== "undefined") {
|
|
16
14
|
g = global;
|
|
17
|
-
} else if (typeof self !==
|
|
15
|
+
} else if (typeof self !== "undefined") {
|
|
18
16
|
g = self;
|
|
19
17
|
} else {
|
|
20
18
|
g = this;
|
|
21
19
|
}g.webrtcIeShim = f();
|
|
22
20
|
}
|
|
23
21
|
})(function () {
|
|
24
|
-
var define, module, exports;
|
|
25
|
-
|
|
26
|
-
return function () {
|
|
22
|
+
var define, module, exports;return function () {
|
|
27
23
|
function r(e, n, t) {
|
|
28
24
|
function o(i, f) {
|
|
29
25
|
if (!n[i]) {
|
|
30
26
|
if (!e[i]) {
|
|
31
|
-
var c = typeof require
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return c(i, !0);
|
|
35
|
-
}if (u) {
|
|
36
|
-
return u(i, !0);
|
|
37
|
-
}var a = new Error('Cannot find module \'' + i + '\'');
|
|
38
|
-
|
|
39
|
-
throw a.code = 'MODULE_NOT_FOUND', a;
|
|
40
|
-
}var p = n[i] = { exports: {} };
|
|
41
|
-
|
|
42
|
-
e[i][0].call(p.exports, function (r) {
|
|
43
|
-
var n = e[i][1][r];
|
|
44
|
-
|
|
45
|
-
return o(n || r);
|
|
27
|
+
var c = "function" == typeof require && require;if (!f && c) return c(i, !0);if (u) return u(i, !0);var a = new Error("Cannot find module '" + i + "'");throw a.code = "MODULE_NOT_FOUND", a;
|
|
28
|
+
}var p = n[i] = { exports: {} };e[i][0].call(p.exports, function (r) {
|
|
29
|
+
var n = e[i][1][r];return o(n || r);
|
|
46
30
|
}, p, p.exports, r, e, n, t);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return n[i].exports;
|
|
50
|
-
}for (var u = typeof require === 'function' && require, i = 0; i < t.length; i++) {
|
|
31
|
+
}return n[i].exports;
|
|
32
|
+
}for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
|
|
51
33
|
o(t[i]);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return o;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return r;
|
|
34
|
+
}return o;
|
|
35
|
+
}return r;
|
|
58
36
|
}()({ 1: [function (require, module, exports) {
|
|
59
37
|
exports.endianness = function () {
|
|
60
38
|
return 'LE';
|
|
@@ -63,9 +41,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
63
41
|
exports.hostname = function () {
|
|
64
42
|
if (typeof location !== 'undefined') {
|
|
65
43
|
return location.hostname;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return '';
|
|
44
|
+
} else return '';
|
|
69
45
|
};
|
|
70
46
|
|
|
71
47
|
exports.loadavg = function () {
|
|
@@ -96,7 +72,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
96
72
|
if (typeof navigator !== 'undefined') {
|
|
97
73
|
return navigator.appVersion;
|
|
98
74
|
}
|
|
99
|
-
|
|
100
75
|
return '';
|
|
101
76
|
};
|
|
102
77
|
|
|
@@ -167,7 +142,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
167
142
|
// if setTimeout wasn't available but was latter defined
|
|
168
143
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
169
144
|
cachedSetTimeout = setTimeout;
|
|
170
|
-
|
|
171
145
|
return setTimeout(fun, 0);
|
|
172
146
|
}
|
|
173
147
|
try {
|
|
@@ -191,7 +165,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
191
165
|
// if clearTimeout wasn't available but was latter defined
|
|
192
166
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
193
167
|
cachedClearTimeout = clearTimeout;
|
|
194
|
-
|
|
195
168
|
return clearTimeout(marker);
|
|
196
169
|
}
|
|
197
170
|
try {
|
|
@@ -233,11 +206,9 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
233
206
|
return;
|
|
234
207
|
}
|
|
235
208
|
var timeout = runTimeout(cleanUpNextTick);
|
|
236
|
-
|
|
237
209
|
draining = true;
|
|
238
210
|
|
|
239
211
|
var len = queue.length;
|
|
240
|
-
|
|
241
212
|
while (len) {
|
|
242
213
|
currentQueue = queue;
|
|
243
214
|
queue = [];
|
|
@@ -256,7 +227,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
256
227
|
|
|
257
228
|
process.nextTick = function (fun) {
|
|
258
229
|
var args = new Array(arguments.length - 1);
|
|
259
|
-
|
|
260
230
|
if (arguments.length > 1) {
|
|
261
231
|
for (var i = 1; i < arguments.length; i++) {
|
|
262
232
|
args[i - 1] = arguments[i];
|
|
@@ -327,9 +297,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
327
297
|
//If it is a video element
|
|
328
298
|
if (node.nodeName.match(/video/i))
|
|
329
299
|
// Observe changes in the video element
|
|
330
|
-
|
|
331
|
-
return VideoRenderer.handle(node);
|
|
332
|
-
}
|
|
300
|
+
return VideoRenderer.handle(node);
|
|
333
301
|
//Look in childs
|
|
334
302
|
for (var j = 0; j < node.childNodes.length; j++) {
|
|
335
303
|
checkNewNode(node.childNodes.item(j));
|
|
@@ -338,9 +306,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
338
306
|
|
|
339
307
|
var checkRemovedNode = function checkRemovedNode(node) {
|
|
340
308
|
//If it is a video element
|
|
341
|
-
if (node.nodeName.match(/video/i))
|
|
342
|
-
return VideoRenderer.unhandle(node);
|
|
343
|
-
}
|
|
309
|
+
if (node.nodeName.match(/video/i)) return VideoRenderer.unhandle(node);
|
|
344
310
|
//Look in childs
|
|
345
311
|
for (var j = 0; j < node.childNodes.length; j++) {
|
|
346
312
|
checkRemovedNode(node.childNodes.item(j));
|
|
@@ -353,7 +319,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
353
319
|
throw new TypeError();
|
|
354
320
|
};
|
|
355
321
|
//Set name
|
|
356
|
-
|
|
357
322
|
Object.defineProperty(Interface, 'name', {
|
|
358
323
|
enumerable: false,
|
|
359
324
|
configurable: true,
|
|
@@ -388,7 +353,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
388
353
|
// Add objects to global
|
|
389
354
|
var MediaDevices = require('./lib/MediaDevices.js');
|
|
390
355
|
var VideoRenderer = require('./lib/VideoRenderer.js');
|
|
391
|
-
|
|
392
356
|
navigator.mediaDevices = new MediaDevices();
|
|
393
357
|
|
|
394
358
|
var RTCPeerConnection = require('./lib/RTCPeerConnection.js');
|
|
@@ -432,9 +396,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
432
396
|
var mutation = mutations[i];
|
|
433
397
|
|
|
434
398
|
// Check if there has been addition or deletion of nodes
|
|
435
|
-
if (mutation.type !== 'childList')
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
399
|
+
if (mutation.type !== 'childList') continue;
|
|
438
400
|
|
|
439
401
|
// Check added nodes.
|
|
440
402
|
for (var j = 0, numNodes = mutation.addedNodes.length; j < numNodes; j++) {
|
|
@@ -456,8 +418,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
456
418
|
VideoRenderer.handle(videos[i]);
|
|
457
419
|
}
|
|
458
420
|
}
|
|
459
|
-
}, {
|
|
460
|
-
|
|
421
|
+
}, { "./lib/EventTarget.js": 4, "./lib/MediaDevices.js": 6, "./lib/MediaStream.js": 7, "./lib/MediaStreamTrack.js": 8, "./lib/RTCDataChannel.js": 9, "./lib/RTCIceCandidate.js": 10, "./lib/RTCPeerConnection.js": 11, "./lib/RTCRtpReceiver.js": 12, "./lib/RTCRtpSender.js": 13, "./lib/RTCRtpTransceiver.js": 14, "./lib/RTCSessionDescription.js": 15, "./lib/VideoRenderer.js": 16, "./lib/WebRTCProxy.js": 17, "detect-browser": 18 }], 4: [function (require, module, exports) {
|
|
461
422
|
/**
|
|
462
423
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
463
424
|
* @copyright 2015 Toru Nagashima. All rights reserved.
|
|
@@ -484,10 +445,10 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
484
445
|
* @private
|
|
485
446
|
*/
|
|
486
447
|
|
|
487
|
-
var _typeof = typeof Symbol ===
|
|
488
|
-
return typeof obj ===
|
|
448
|
+
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
|
449
|
+
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
489
450
|
} : function (obj) {
|
|
490
|
-
return obj && typeof Symbol ===
|
|
451
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
491
452
|
};
|
|
492
453
|
|
|
493
454
|
var privateData = new WeakMap();
|
|
@@ -507,9 +468,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
507
468
|
*/
|
|
508
469
|
function pd(event) {
|
|
509
470
|
var retv = privateData.get(event);
|
|
510
|
-
|
|
511
|
-
console.assert(retv != null, '\'this\' is expected an Event object, but got', event);
|
|
512
|
-
|
|
471
|
+
console.assert(retv != null, "'this' is expected an Event object, but got", event);
|
|
513
472
|
return retv;
|
|
514
473
|
}
|
|
515
474
|
|
|
@@ -536,14 +495,12 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
536
495
|
});
|
|
537
496
|
|
|
538
497
|
// https://heycam.github.io/webidl/#Unforgeable
|
|
539
|
-
Object.defineProperty(this,
|
|
498
|
+
Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
|
|
540
499
|
|
|
541
500
|
// Define accessors
|
|
542
501
|
var keys = Object.keys(event);
|
|
543
|
-
|
|
544
502
|
for (var i = 0; i < keys.length; ++i) {
|
|
545
503
|
var key = keys[i];
|
|
546
|
-
|
|
547
504
|
if (!(key in this)) {
|
|
548
505
|
Object.defineProperty(this, key, defineRedirectDescriptor(key));
|
|
549
506
|
}
|
|
@@ -552,7 +509,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
552
509
|
|
|
553
510
|
// Should be enumerable, but class methods are not enumerable.
|
|
554
511
|
Event.prototype = {
|
|
555
|
-
|
|
556
512
|
/**
|
|
557
513
|
* The type of this event.
|
|
558
514
|
* @type {string}
|
|
@@ -582,11 +538,9 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
582
538
|
*/
|
|
583
539
|
composedPath: function composedPath() {
|
|
584
540
|
var currentTarget = pd(this).currentTarget;
|
|
585
|
-
|
|
586
541
|
if (currentTarget == null) {
|
|
587
542
|
return [];
|
|
588
543
|
}
|
|
589
|
-
|
|
590
544
|
return [currentTarget];
|
|
591
545
|
},
|
|
592
546
|
|
|
@@ -636,8 +590,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
636
590
|
*/
|
|
637
591
|
stopPropagation: function stopPropagation() {
|
|
638
592
|
var data = pd(this);
|
|
639
|
-
|
|
640
|
-
if (typeof data.event.stopPropagation === 'function') {
|
|
593
|
+
if (typeof data.event.stopPropagation === "function") {
|
|
641
594
|
data.event.stopPropagation();
|
|
642
595
|
}
|
|
643
596
|
},
|
|
@@ -650,7 +603,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
650
603
|
var data = pd(this);
|
|
651
604
|
|
|
652
605
|
data.stopped = true;
|
|
653
|
-
if (typeof data.event.stopImmediatePropagation ===
|
|
606
|
+
if (typeof data.event.stopImmediatePropagation === "function") {
|
|
654
607
|
data.event.stopImmediatePropagation();
|
|
655
608
|
}
|
|
656
609
|
},
|
|
@@ -677,10 +630,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
677
630
|
*/
|
|
678
631
|
preventDefault: function preventDefault() {
|
|
679
632
|
var data = pd(this);
|
|
680
|
-
|
|
681
633
|
if (data.passiveListener != null) {
|
|
682
|
-
console.warn(
|
|
683
|
-
|
|
634
|
+
console.warn("Event#preventDefault() was called from a passive listener:", data.passiveListener);
|
|
684
635
|
return;
|
|
685
636
|
}
|
|
686
637
|
if (!data.event.cancelable) {
|
|
@@ -688,7 +639,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
688
639
|
}
|
|
689
640
|
|
|
690
641
|
data.canceled = true;
|
|
691
|
-
if (typeof data.event.preventDefault ===
|
|
642
|
+
if (typeof data.event.preventDefault === "function") {
|
|
692
643
|
data.event.preventDefault();
|
|
693
644
|
}
|
|
694
645
|
},
|
|
@@ -719,10 +670,10 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
719
670
|
};
|
|
720
671
|
|
|
721
672
|
// `constructor` is not enumerable.
|
|
722
|
-
Object.defineProperty(Event.prototype,
|
|
673
|
+
Object.defineProperty(Event.prototype, "constructor", { value: Event, configurable: true, writable: true });
|
|
723
674
|
|
|
724
675
|
// Ensure `event instanceof window.Event` is `true`.
|
|
725
|
-
if (typeof window !==
|
|
676
|
+
if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
|
|
726
677
|
Object.setPrototypeOf(Event.prototype, window.Event.prototype);
|
|
727
678
|
|
|
728
679
|
// Make association for wrappers.
|
|
@@ -759,7 +710,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
759
710
|
return {
|
|
760
711
|
value: function value() {
|
|
761
712
|
var event = pd(this).event;
|
|
762
|
-
|
|
763
713
|
return event[key].apply(event, arguments);
|
|
764
714
|
},
|
|
765
715
|
|
|
@@ -777,7 +727,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
777
727
|
*/
|
|
778
728
|
function defineWrapper(BaseEvent, proto) {
|
|
779
729
|
var keys = Object.keys(proto);
|
|
780
|
-
|
|
781
730
|
if (keys.length === 0) {
|
|
782
731
|
return BaseEvent;
|
|
783
732
|
}
|
|
@@ -794,11 +743,9 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
794
743
|
// Define accessors.
|
|
795
744
|
for (var i = 0; i < keys.length; ++i) {
|
|
796
745
|
var key = keys[i];
|
|
797
|
-
|
|
798
746
|
if (!(key in BaseEvent.prototype)) {
|
|
799
747
|
var descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
800
|
-
var isFunc = typeof descriptor.value ===
|
|
801
|
-
|
|
748
|
+
var isFunc = typeof descriptor.value === "function";
|
|
802
749
|
Object.defineProperty(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
|
|
803
750
|
}
|
|
804
751
|
}
|
|
@@ -818,12 +765,10 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
818
765
|
}
|
|
819
766
|
|
|
820
767
|
var wrapper = wrappers.get(proto);
|
|
821
|
-
|
|
822
768
|
if (wrapper == null) {
|
|
823
769
|
wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
|
|
824
770
|
wrappers.set(proto, wrapper);
|
|
825
771
|
}
|
|
826
|
-
|
|
827
772
|
return wrapper;
|
|
828
773
|
}
|
|
829
774
|
|
|
@@ -836,7 +781,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
836
781
|
*/
|
|
837
782
|
function wrapEvent(eventTarget, event) {
|
|
838
783
|
var Wrapper = getWrapper(Object.getPrototypeOf(event));
|
|
839
|
-
|
|
840
784
|
return new Wrapper(eventTarget, event);
|
|
841
785
|
}
|
|
842
786
|
|
|
@@ -910,7 +854,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
910
854
|
* @returns {boolean} `true` if the value is an object.
|
|
911
855
|
*/
|
|
912
856
|
function isObject(x) {
|
|
913
|
-
return x !== null && (typeof x ===
|
|
857
|
+
return x !== null && (typeof x === "undefined" ? "undefined" : _typeof(x)) === "object"; //eslint-disable-line no-restricted-syntax
|
|
914
858
|
}
|
|
915
859
|
|
|
916
860
|
/**
|
|
@@ -921,9 +865,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
921
865
|
*/
|
|
922
866
|
function getListeners(eventTarget) {
|
|
923
867
|
var listeners = listenersMap.get(eventTarget);
|
|
924
|
-
|
|
925
|
-
console.assert(listeners != null, '\'this\' is expected an EventTarget object');
|
|
926
|
-
|
|
868
|
+
console.assert(listeners != null, "'this' is expected an EventTarget object");
|
|
927
869
|
return listeners || new Map();
|
|
928
870
|
}
|
|
929
871
|
|
|
@@ -938,18 +880,16 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
938
880
|
get: function get() {
|
|
939
881
|
var listeners = getListeners(this);
|
|
940
882
|
var node = listeners.get(eventName);
|
|
941
|
-
|
|
942
883
|
while (node != null) {
|
|
943
884
|
if (node.listenerType === ATTRIBUTE) {
|
|
944
885
|
return node.listener;
|
|
945
886
|
}
|
|
946
887
|
node = node.next;
|
|
947
888
|
}
|
|
948
|
-
|
|
949
889
|
return null;
|
|
950
890
|
},
|
|
951
891
|
set: function set(listener) {
|
|
952
|
-
if (typeof listener !==
|
|
892
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
953
893
|
listener = null; // eslint-disable-line no-param-reassign
|
|
954
894
|
}
|
|
955
895
|
var listeners = getListeners(this);
|
|
@@ -957,7 +897,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
957
897
|
// Traverse to the tail while removing old value.
|
|
958
898
|
var prev = null;
|
|
959
899
|
var node = listeners.get(eventName);
|
|
960
|
-
|
|
961
900
|
while (node != null) {
|
|
962
901
|
if (node.listenerType === ATTRIBUTE) {
|
|
963
902
|
// Remove old value.
|
|
@@ -984,7 +923,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
984
923
|
once: false,
|
|
985
924
|
next: null
|
|
986
925
|
};
|
|
987
|
-
|
|
988
926
|
if (prev === null) {
|
|
989
927
|
listeners.set(eventName, newNode);
|
|
990
928
|
} else {
|
|
@@ -1005,7 +943,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1005
943
|
* @returns {void}
|
|
1006
944
|
*/
|
|
1007
945
|
function defineEventAttribute(eventTargetPrototype, eventName) {
|
|
1008
|
-
Object.defineProperty(eventTargetPrototype,
|
|
946
|
+
Object.defineProperty(eventTargetPrototype, "on" + eventName, defineEventAttributeDescriptor(eventName));
|
|
1009
947
|
}
|
|
1010
948
|
|
|
1011
949
|
/**
|
|
@@ -1015,7 +953,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1015
953
|
* @private
|
|
1016
954
|
*/
|
|
1017
955
|
function defineCustomEventTarget(eventNames) {
|
|
1018
|
-
|
|
1019
956
|
/** CustomEventTarget */
|
|
1020
957
|
function CustomEventTarget() {
|
|
1021
958
|
EventTarget.call(this);
|
|
@@ -1034,12 +971,12 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1034
971
|
|
|
1035
972
|
/**
|
|
1036
973
|
* EventTarget.
|
|
1037
|
-
*
|
|
974
|
+
*
|
|
1038
975
|
* - This is constructor if no arguments.
|
|
1039
976
|
* - This is a function which returns a CustomEventTarget constructor if there are arguments.
|
|
1040
|
-
*
|
|
977
|
+
*
|
|
1041
978
|
* For example:
|
|
1042
|
-
*
|
|
979
|
+
*
|
|
1043
980
|
* class A extends EventTarget {}
|
|
1044
981
|
* class B extends EventTarget("message") {}
|
|
1045
982
|
* class C extends EventTarget("message", "error") {}
|
|
@@ -1049,7 +986,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1049
986
|
/*eslint-disable consistent-return */
|
|
1050
987
|
if (this instanceof EventTarget) {
|
|
1051
988
|
listenersMap.set(this, new Map());
|
|
1052
|
-
|
|
1053
989
|
return;
|
|
1054
990
|
}
|
|
1055
991
|
if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
|
@@ -1057,20 +993,17 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1057
993
|
}
|
|
1058
994
|
if (arguments.length > 0) {
|
|
1059
995
|
var types = new Array(arguments.length);
|
|
1060
|
-
|
|
1061
996
|
for (var i = 0; i < arguments.length; ++i) {
|
|
1062
997
|
types[i] = arguments[i];
|
|
1063
998
|
}
|
|
1064
|
-
|
|
1065
999
|
return defineCustomEventTarget(types);
|
|
1066
1000
|
}
|
|
1067
|
-
throw new TypeError(
|
|
1001
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1068
1002
|
/*eslint-enable consistent-return */
|
|
1069
1003
|
}
|
|
1070
1004
|
|
|
1071
1005
|
// Should be enumerable, but class methods are not enumerable.
|
|
1072
1006
|
EventTarget.prototype = {
|
|
1073
|
-
|
|
1074
1007
|
/**
|
|
1075
1008
|
* Add a given listener to this event target.
|
|
1076
1009
|
* @param {string} eventName The event name to add.
|
|
@@ -1082,8 +1015,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1082
1015
|
if (listener == null) {
|
|
1083
1016
|
return false;
|
|
1084
1017
|
}
|
|
1085
|
-
if (typeof listener !==
|
|
1086
|
-
throw new TypeError('
|
|
1018
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
1019
|
+
throw new TypeError("'listener' should be a function or an object.");
|
|
1087
1020
|
}
|
|
1088
1021
|
|
|
1089
1022
|
var listeners = getListeners(this);
|
|
@@ -1100,16 +1033,13 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1100
1033
|
|
|
1101
1034
|
// Set it as the first node if the first node is null.
|
|
1102
1035
|
var node = listeners.get(eventName);
|
|
1103
|
-
|
|
1104
1036
|
if (node === undefined) {
|
|
1105
1037
|
listeners.set(eventName, newNode);
|
|
1106
|
-
|
|
1107
1038
|
return true;
|
|
1108
1039
|
}
|
|
1109
1040
|
|
|
1110
1041
|
// Traverse to the tail while checking duplication..
|
|
1111
1042
|
var prev = null;
|
|
1112
|
-
|
|
1113
1043
|
while (node != null) {
|
|
1114
1044
|
if (node.listener === listener && node.listenerType === listenerType) {
|
|
1115
1045
|
// Should ignore duplication.
|
|
@@ -1121,7 +1051,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1121
1051
|
|
|
1122
1052
|
// Add it.
|
|
1123
1053
|
prev.next = newNode;
|
|
1124
|
-
|
|
1125
1054
|
return true;
|
|
1126
1055
|
},
|
|
1127
1056
|
|
|
@@ -1143,7 +1072,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1143
1072
|
|
|
1144
1073
|
var prev = null;
|
|
1145
1074
|
var node = listeners.get(eventName);
|
|
1146
|
-
|
|
1147
1075
|
while (node != null) {
|
|
1148
1076
|
if (node.listener === listener && node.listenerType === listenerType) {
|
|
1149
1077
|
if (prev !== null) {
|
|
@@ -1153,7 +1081,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1153
1081
|
} else {
|
|
1154
1082
|
listeners.delete(eventName);
|
|
1155
1083
|
}
|
|
1156
|
-
|
|
1157
1084
|
return true;
|
|
1158
1085
|
}
|
|
1159
1086
|
|
|
@@ -1170,15 +1097,14 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1170
1097
|
* @returns {boolean} `false` if canceled.
|
|
1171
1098
|
*/
|
|
1172
1099
|
dispatchEvent: function dispatchEvent(event) {
|
|
1173
|
-
if (event == null || typeof event.type !==
|
|
1174
|
-
throw new TypeError(
|
|
1100
|
+
if (event == null || typeof event.type !== "string") {
|
|
1101
|
+
throw new TypeError("\"event.type\" should be a string.");
|
|
1175
1102
|
}
|
|
1176
1103
|
|
|
1177
1104
|
// If listeners aren't registered, terminate.
|
|
1178
1105
|
var listeners = getListeners(this);
|
|
1179
1106
|
var eventName = event.type;
|
|
1180
1107
|
var node = listeners.get(eventName);
|
|
1181
|
-
|
|
1182
1108
|
if (node == null) {
|
|
1183
1109
|
return true;
|
|
1184
1110
|
}
|
|
@@ -1189,7 +1115,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1189
1115
|
// This doesn't process capturing phase and bubbling phase.
|
|
1190
1116
|
// This isn't participating in a tree.
|
|
1191
1117
|
var prev = null;
|
|
1192
|
-
|
|
1193
1118
|
while (node != null) {
|
|
1194
1119
|
// Remove this listener if it's once
|
|
1195
1120
|
if (node.once) {
|
|
@@ -1206,9 +1131,9 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1206
1131
|
|
|
1207
1132
|
// Call this listener
|
|
1208
1133
|
setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
|
|
1209
|
-
if (typeof node.listener ===
|
|
1134
|
+
if (typeof node.listener === "function") {
|
|
1210
1135
|
node.listener.call(this, wrappedEvent);
|
|
1211
|
-
} else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent ===
|
|
1136
|
+
} else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
|
|
1212
1137
|
node.listener.handleEvent(wrappedEvent);
|
|
1213
1138
|
}
|
|
1214
1139
|
|
|
@@ -1228,24 +1153,23 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1228
1153
|
};
|
|
1229
1154
|
|
|
1230
1155
|
// `constructor` is not enumerable.
|
|
1231
|
-
Object.defineProperty(EventTarget.prototype,
|
|
1156
|
+
Object.defineProperty(EventTarget.prototype, "constructor", { value: EventTarget, configurable: true, writable: true });
|
|
1232
1157
|
|
|
1233
1158
|
// Ensure `eventTarget instanceof window.EventTarget` is `true`.
|
|
1234
|
-
if (typeof window !==
|
|
1159
|
+
if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
|
|
1235
1160
|
Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
|
|
1236
1161
|
}
|
|
1237
1162
|
|
|
1238
1163
|
module.exports = EventTarget;
|
|
1239
|
-
module.exports.EventTarget = module.exports
|
|
1164
|
+
module.exports.EventTarget = module.exports["default"] = EventTarget;
|
|
1240
1165
|
module.exports.defineEventAttribute = defineEventAttribute;
|
|
1241
1166
|
}, {}], 5: [function (require, module, exports) {
|
|
1242
|
-
|
|
1167
|
+
"use strict";
|
|
1243
1168
|
|
|
1244
1169
|
function InvalidStateError() {
|
|
1245
1170
|
try {
|
|
1246
1171
|
var xhr = new XMLHttpRequest();
|
|
1247
|
-
|
|
1248
|
-
xhr.responseType = 'blob';
|
|
1172
|
+
xhr.responseType = "blob";
|
|
1249
1173
|
} catch (e) {
|
|
1250
1174
|
return e;
|
|
1251
1175
|
}
|
|
@@ -1262,14 +1186,15 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1262
1186
|
var defineEventAttribute = require('./EventTarget.js').defineEventAttribute;
|
|
1263
1187
|
|
|
1264
1188
|
/*
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1189
|
+
interface MediaDevices : EventTarget {
|
|
1190
|
+
attribute EventHandler ondevicechange;
|
|
1191
|
+
Promise<sequence<MediaDeviceInfo>> enumerateDevices();
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
partial interface MediaDevices {
|
|
1195
|
+
MediaTrackSupportedConstraints getSupportedConstraints();
|
|
1196
|
+
Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints);
|
|
1197
|
+
}
|
|
1273
1198
|
*/
|
|
1274
1199
|
var MediaDevices = function MediaDevices() {
|
|
1275
1200
|
//Init event targetr
|
|
@@ -1302,13 +1227,11 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1302
1227
|
return new Promise(function (resolve, reject) {
|
|
1303
1228
|
var stream = new MediaStream();
|
|
1304
1229
|
//If we are being requested audio
|
|
1305
|
-
|
|
1306
1230
|
if (constraints.audio) {
|
|
1307
1231
|
var options = {};
|
|
1308
1232
|
//Get new track
|
|
1309
1233
|
var track = WebRTCProxy.createLocalAudioTrack(options);
|
|
1310
1234
|
//Add it to the stream
|
|
1311
|
-
|
|
1312
1235
|
stream.addTrack(new MediaStreamTrack(track));
|
|
1313
1236
|
}
|
|
1314
1237
|
//If we are being requested video
|
|
@@ -1317,7 +1240,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1317
1240
|
//Get new track
|
|
1318
1241
|
var track = WebRTCProxy.createLocalVideoTrack(options);
|
|
1319
1242
|
//Add it to the stream
|
|
1320
|
-
|
|
1321
1243
|
stream.addTrack(new MediaStreamTrack(track));
|
|
1322
1244
|
}
|
|
1323
1245
|
//Done
|
|
@@ -1333,13 +1255,12 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1333
1255
|
});
|
|
1334
1256
|
Object.defineProperty(MediaDevices, 'prototype', { writable: false });
|
|
1335
1257
|
module.exports = MediaDevices;
|
|
1336
|
-
}, {
|
|
1258
|
+
}, { "./EventTarget.js": 4, "./MediaStream.js": 7, "./MediaStreamTrack.js": 8, "./WebRTCProxy.js": 17 }], 7: [function (require, module, exports) {
|
|
1337
1259
|
'use strict';
|
|
1338
1260
|
|
|
1339
1261
|
var MediaStreamTrack = require('./MediaStreamTrack');
|
|
1340
1262
|
var EventTarget = require('./EventTarget.js').EventTarget;
|
|
1341
1263
|
var defineEventAttribute = require('./EventTarget.js').defineEventAttribute;
|
|
1342
|
-
|
|
1343
1264
|
/*
|
|
1344
1265
|
[Exposed=Window,
|
|
1345
1266
|
Constructor,
|
|
@@ -1357,7 +1278,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1357
1278
|
readonly attribute boolean active;
|
|
1358
1279
|
attribute EventHandler onaddtrack;
|
|
1359
1280
|
attribute EventHandler onremovetrack;
|
|
1360
|
-
};
|
|
1281
|
+
};
|
|
1361
1282
|
*/
|
|
1362
1283
|
var count = 0;
|
|
1363
1284
|
|
|
@@ -1409,35 +1330,27 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1409
1330
|
|
|
1410
1331
|
MediaStream.prototype.getAudioTracks = function () {
|
|
1411
1332
|
var arr = [];
|
|
1412
|
-
|
|
1413
1333
|
for (var id in this.priv.tracks) {
|
|
1414
1334
|
if (this.priv.tracks[id].kind === 'audio') {
|
|
1415
1335
|
arr.push(this.priv.tracks[id]);
|
|
1416
1336
|
}
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
return arr;
|
|
1337
|
+
}return arr;
|
|
1420
1338
|
};
|
|
1421
1339
|
|
|
1422
1340
|
MediaStream.prototype.getVideoTracks = function () {
|
|
1423
1341
|
var arr = [];
|
|
1424
|
-
|
|
1425
1342
|
for (var id in this.priv.tracks) {
|
|
1426
1343
|
if (this.priv.tracks[id].kind === 'video') {
|
|
1427
1344
|
arr.push(this.priv.tracks[id]);
|
|
1428
1345
|
}
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
return arr;
|
|
1346
|
+
}return arr;
|
|
1432
1347
|
};
|
|
1433
1348
|
|
|
1434
1349
|
MediaStream.prototype.getTracks = function () {
|
|
1435
1350
|
var arr = [];
|
|
1436
|
-
|
|
1437
1351
|
for (var id in this.priv.tracks) {
|
|
1438
1352
|
arr.push(this.priv.tracks[id]);
|
|
1439
1353
|
}
|
|
1440
|
-
|
|
1441
1354
|
return arr;
|
|
1442
1355
|
};
|
|
1443
1356
|
|
|
@@ -1447,9 +1360,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1447
1360
|
|
|
1448
1361
|
MediaStream.prototype.addTrack = function (track) {
|
|
1449
1362
|
//Check if already present
|
|
1450
|
-
if (this.priv.tracks.hasOwnProperty(track.id))
|
|
1451
|
-
return;
|
|
1452
|
-
}
|
|
1363
|
+
if (this.priv.tracks.hasOwnProperty(track.id)) return;
|
|
1453
1364
|
//Add to track
|
|
1454
1365
|
this.priv.tracks[track.id] = track;
|
|
1455
1366
|
|
|
@@ -1459,7 +1370,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1459
1370
|
|
|
1460
1371
|
//Create event
|
|
1461
1372
|
var event = document.createEvent('Event');
|
|
1462
|
-
|
|
1463
1373
|
event.initEvent('addtrack', false, false);
|
|
1464
1374
|
event.track = track;
|
|
1465
1375
|
//Fire it
|
|
@@ -1468,14 +1378,11 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1468
1378
|
|
|
1469
1379
|
MediaStream.prototype.removeTrack = function (track) {
|
|
1470
1380
|
//Check if it is not already present
|
|
1471
|
-
if (!this.priv.tracks.hasOwnProperty(track.id))
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1381
|
+
if (!this.priv.tracks.hasOwnProperty(track.id)) return;
|
|
1474
1382
|
//Add to track
|
|
1475
1383
|
delete this.priv.tracks[track.id];
|
|
1476
1384
|
//Create event
|
|
1477
1385
|
var event = document.createEvent('Event');
|
|
1478
|
-
|
|
1479
1386
|
event.initEvent('removetrack', false, false);
|
|
1480
1387
|
event.track = track;
|
|
1481
1388
|
//Fire it
|
|
@@ -1494,12 +1401,11 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1494
1401
|
});
|
|
1495
1402
|
Object.defineProperty(MediaStream, 'prototype', { writable: false });
|
|
1496
1403
|
module.exports = MediaStream;
|
|
1497
|
-
}, {
|
|
1404
|
+
}, { "./EventTarget.js": 4, "./MediaStreamTrack": 8 }], 8: [function (require, module, exports) {
|
|
1498
1405
|
'use strict';
|
|
1499
1406
|
|
|
1500
1407
|
var EventTarget = require('./EventTarget.js').EventTarget;
|
|
1501
1408
|
var defineEventAttribute = require('./EventTarget.js').defineEventAttribute;
|
|
1502
|
-
|
|
1503
1409
|
/*
|
|
1504
1410
|
[Exposed=Window]
|
|
1505
1411
|
interface MediaStreamTrack : EventTarget {
|
|
@@ -1520,7 +1426,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1520
1426
|
Promise<void> applyConstraints(optional MediaTrackConstraints constraints);
|
|
1521
1427
|
attribute EventHandler onoverconstrained;
|
|
1522
1428
|
};
|
|
1523
|
-
|
|
1429
|
+
|
|
1430
|
+
partial interface MediaStreamTrack {
|
|
1524
1431
|
readonly attribute boolean isolated;
|
|
1525
1432
|
attribute EventHandler onisolationchange;
|
|
1526
1433
|
};
|
|
@@ -1618,12 +1525,12 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1618
1525
|
value: 'MediaStreamTrack'
|
|
1619
1526
|
});
|
|
1620
1527
|
module.exports = MediaStreamTrack;
|
|
1621
|
-
}, {
|
|
1622
|
-
|
|
1528
|
+
}, { "./EventTarget.js": 4 }], 9: [function (require, module, exports) {
|
|
1529
|
+
"use strict";
|
|
1623
1530
|
|
|
1624
|
-
var EventTarget = require(
|
|
1625
|
-
var defineEventAttribute = require(
|
|
1626
|
-
var InvalidStateError = require(
|
|
1531
|
+
var EventTarget = require("./EventTarget.js").EventTarget;
|
|
1532
|
+
var defineEventAttribute = require("./EventTarget.js").defineEventAttribute;
|
|
1533
|
+
var InvalidStateError = require("./InvalidStateError.js");
|
|
1627
1534
|
|
|
1628
1535
|
/*
|
|
1629
1536
|
[Exposed=Window]
|
|
@@ -1659,7 +1566,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1659
1566
|
//Private vars
|
|
1660
1567
|
var self = this;
|
|
1661
1568
|
var priv = this.priv = {
|
|
1662
|
-
binaryType:
|
|
1569
|
+
binaryType: "blob",
|
|
1663
1570
|
dataChannel: dataChannel
|
|
1664
1571
|
};
|
|
1665
1572
|
|
|
@@ -1705,19 +1612,14 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1705
1612
|
return priv.dataChannel.bufferedAmount;
|
|
1706
1613
|
},
|
|
1707
1614
|
set: function set(binaryType) {
|
|
1708
|
-
if (binaryType !==
|
|
1709
|
-
throw new SyntaxError();
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1615
|
+
if (binaryType !== "blob" && binaryType !== "arraybuffer") throw new SyntaxError();
|
|
1712
1616
|
return priv.binaryType = binaryType;
|
|
1713
1617
|
}
|
|
1714
1618
|
});
|
|
1715
1619
|
|
|
1716
1620
|
function createEvent(name) {
|
|
1717
|
-
var e = document.createEvent(
|
|
1718
|
-
|
|
1621
|
+
var e = document.createEvent("Event");
|
|
1719
1622
|
e.initEvent(name, false, false);
|
|
1720
|
-
|
|
1721
1623
|
return e;
|
|
1722
1624
|
}
|
|
1723
1625
|
|
|
@@ -1727,47 +1629,43 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1727
1629
|
|
|
1728
1630
|
//Set event
|
|
1729
1631
|
priv.dataChannel.onopen = function () {
|
|
1730
|
-
fire(
|
|
1632
|
+
fire("open");
|
|
1731
1633
|
};
|
|
1732
1634
|
priv.dataChannel.onbufferedamountlow = function () {
|
|
1733
|
-
fire(
|
|
1635
|
+
fire("bufferedamountlow");
|
|
1734
1636
|
};
|
|
1735
1637
|
priv.dataChannel.onerror = function () {
|
|
1736
|
-
fire(
|
|
1638
|
+
fire("error");
|
|
1737
1639
|
};
|
|
1738
1640
|
priv.dataChannel.onclose = function () {
|
|
1739
|
-
fire(
|
|
1641
|
+
fire("close");
|
|
1740
1642
|
};
|
|
1741
1643
|
priv.dataChannel.onmessage = function (message) {
|
|
1742
1644
|
//Create event
|
|
1743
|
-
var event = createEvent(
|
|
1645
|
+
var event = createEvent("message");
|
|
1744
1646
|
|
|
1745
1647
|
//Check if message is binary
|
|
1746
|
-
if (typeof message !==
|
|
1648
|
+
if (typeof message !== "string") {
|
|
1747
1649
|
//Create uint array
|
|
1748
1650
|
var array = new Uint8Array(message);
|
|
1749
1651
|
//Check binary type
|
|
1750
|
-
|
|
1751
|
-
if (priv.binaryType === 'blob') {
|
|
1652
|
+
if (priv.binaryType === "blob") {
|
|
1752
1653
|
//Create blob builder
|
|
1753
1654
|
var builder = new MSBlobBuilder();
|
|
1754
1655
|
//Append message
|
|
1755
|
-
|
|
1756
1656
|
builder.append(array);
|
|
1757
1657
|
//Get blob
|
|
1758
1658
|
event.data = builder.getBlob();
|
|
1759
|
-
} else if (priv.binaryType ===
|
|
1659
|
+
} else if (priv.binaryType === "arraybuffer") {
|
|
1760
1660
|
//Get array buffer
|
|
1761
1661
|
event.data = array.buffer;
|
|
1762
|
-
} else
|
|
1763
|
-
return;
|
|
1764
|
-
}
|
|
1662
|
+
} else return;
|
|
1765
1663
|
} else {
|
|
1766
1664
|
//It is a string
|
|
1767
1665
|
event.data = message;
|
|
1768
1666
|
}
|
|
1769
1667
|
|
|
1770
|
-
//Check if
|
|
1668
|
+
//Check if
|
|
1771
1669
|
self.dispatchEvent(event);
|
|
1772
1670
|
};
|
|
1773
1671
|
|
|
@@ -1786,30 +1684,25 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1786
1684
|
RTCDataChannel.__proto__ = EventTarget;
|
|
1787
1685
|
|
|
1788
1686
|
// Define Event Handlers
|
|
1789
|
-
defineEventAttribute(RTCDataChannel.prototype,
|
|
1790
|
-
defineEventAttribute(RTCDataChannel.prototype,
|
|
1791
|
-
defineEventAttribute(RTCDataChannel.prototype,
|
|
1792
|
-
defineEventAttribute(RTCDataChannel.prototype,
|
|
1793
|
-
defineEventAttribute(RTCDataChannel.prototype,
|
|
1687
|
+
defineEventAttribute(RTCDataChannel.prototype, "open");
|
|
1688
|
+
defineEventAttribute(RTCDataChannel.prototype, "bufferedamountlow");
|
|
1689
|
+
defineEventAttribute(RTCDataChannel.prototype, "error");
|
|
1690
|
+
defineEventAttribute(RTCDataChannel.prototype, "close");
|
|
1691
|
+
defineEventAttribute(RTCDataChannel.prototype, "message");
|
|
1794
1692
|
|
|
1795
1693
|
RTCDataChannel.prototype.send = function (data) {
|
|
1796
1694
|
var self = this;
|
|
1797
1695
|
//Check state
|
|
1798
|
-
|
|
1799
|
-
if (this.readyState !== 'open') {
|
|
1800
|
-
throw new InvalidStateError();
|
|
1801
|
-
}
|
|
1696
|
+
if (this.readyState !== "open") throw new InvalidStateError();
|
|
1802
1697
|
|
|
1803
1698
|
try {
|
|
1804
1699
|
//Check type
|
|
1805
1700
|
if (data instanceof Blob) {
|
|
1806
1701
|
var reader = new FileReader();
|
|
1807
|
-
|
|
1808
1702
|
reader.onloadend = function () {
|
|
1809
1703
|
//Create array from buffer
|
|
1810
1704
|
var array = new Uint8Array(reader.result);
|
|
1811
1705
|
//Send it
|
|
1812
|
-
|
|
1813
1706
|
self.priv.dataChannel.send(array);
|
|
1814
1707
|
};
|
|
1815
1708
|
//Read data as array
|
|
@@ -1817,7 +1710,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1817
1710
|
} else if (data instanceof ArrayBuffer) {
|
|
1818
1711
|
//Send it
|
|
1819
1712
|
this.priv.dataChannel.send(array);
|
|
1820
|
-
} else if (typeof data ===
|
|
1713
|
+
} else if (typeof data === "string") {
|
|
1821
1714
|
//Send it
|
|
1822
1715
|
this.priv.dataChannel.send(data);
|
|
1823
1716
|
} else {
|
|
@@ -1832,14 +1725,13 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1832
1725
|
this.priv.dataChannel.close();
|
|
1833
1726
|
};
|
|
1834
1727
|
|
|
1835
|
-
Object.defineProperty(RTCDataChannel, 'name', { enumerable: false, configurable: true, writable: false, value:
|
|
1728
|
+
Object.defineProperty(RTCDataChannel, 'name', { enumerable: false, configurable: true, writable: false, value: "RTCDataChannel" });
|
|
1836
1729
|
Object.defineProperty(RTCDataChannel, 'prototype', { writable: false });
|
|
1837
1730
|
module.exports = RTCDataChannel;
|
|
1838
|
-
}, {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
var WebRTCProxy = require('./WebRTCProxy.js');
|
|
1731
|
+
}, { "./EventTarget.js": 4, "./InvalidStateError.js": 5 }], 10: [function (require, module, exports) {
|
|
1732
|
+
"use strict";
|
|
1842
1733
|
|
|
1734
|
+
var WebRTCProxy = require("./WebRTCProxy.js");
|
|
1843
1735
|
/*
|
|
1844
1736
|
interface RTCIceCandidate {
|
|
1845
1737
|
readonly attribute DOMString candidate;
|
|
@@ -1860,9 +1752,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1860
1752
|
};
|
|
1861
1753
|
*/
|
|
1862
1754
|
var RTCIceCandidate = function RTCIceCandidate(iceCandidateInit) {
|
|
1863
|
-
if (!iceCandidateInit)
|
|
1864
|
-
throw new TypeError();
|
|
1865
|
-
}
|
|
1755
|
+
if (!iceCandidateInit) throw new TypeError();
|
|
1866
1756
|
|
|
1867
1757
|
//Get values from dictionary
|
|
1868
1758
|
var candidate = iceCandidateInit.candidate;
|
|
@@ -1911,52 +1801,50 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1911
1801
|
tcpType = parsed[7];
|
|
1912
1802
|
relatedAddress = parsed[8];
|
|
1913
1803
|
relatedPort = parsed[9];
|
|
1914
|
-
if (!usernameFragment)
|
|
1915
|
-
usernameFragment = parsed[10];
|
|
1916
|
-
}
|
|
1804
|
+
if (!usernameFragment) usernameFragment = parsed[10];
|
|
1917
1805
|
}
|
|
1918
1806
|
|
|
1919
1807
|
//Direct attributes from init
|
|
1920
|
-
Object.defineProperty(this,
|
|
1808
|
+
Object.defineProperty(this, "candidate", { enumerable: true, configurable: false, get: function get() {
|
|
1921
1809
|
return candidate;
|
|
1922
1810
|
} });
|
|
1923
|
-
Object.defineProperty(this,
|
|
1811
|
+
Object.defineProperty(this, "sdpMid", { enumerable: true, configurable: false, get: function get() {
|
|
1924
1812
|
return sdpMid;
|
|
1925
1813
|
} });
|
|
1926
|
-
Object.defineProperty(this,
|
|
1814
|
+
Object.defineProperty(this, "sdpMLineIndex", { enumerable: true, configurable: false, get: function get() {
|
|
1927
1815
|
return sdpMLineIndex;
|
|
1928
1816
|
} });
|
|
1929
|
-
Object.defineProperty(this,
|
|
1817
|
+
Object.defineProperty(this, "foundation", { enumerable: true, configurable: false, get: function get() {
|
|
1930
1818
|
return foundation;
|
|
1931
1819
|
} });
|
|
1932
|
-
Object.defineProperty(this,
|
|
1820
|
+
Object.defineProperty(this, "component", { enumerable: true, configurable: false, get: function get() {
|
|
1933
1821
|
return component;
|
|
1934
1822
|
} });
|
|
1935
|
-
Object.defineProperty(this,
|
|
1823
|
+
Object.defineProperty(this, "priority", { enumerable: true, configurable: false, get: function get() {
|
|
1936
1824
|
return priority;
|
|
1937
1825
|
} });
|
|
1938
|
-
Object.defineProperty(this,
|
|
1826
|
+
Object.defineProperty(this, "ip", { enumerable: true, configurable: false, get: function get() {
|
|
1939
1827
|
return ip;
|
|
1940
1828
|
} });
|
|
1941
|
-
Object.defineProperty(this,
|
|
1829
|
+
Object.defineProperty(this, "protocol", { enumerable: true, configurable: false, get: function get() {
|
|
1942
1830
|
return protocol;
|
|
1943
1831
|
} });
|
|
1944
|
-
Object.defineProperty(this,
|
|
1832
|
+
Object.defineProperty(this, "port", { enumerable: true, configurable: false, get: function get() {
|
|
1945
1833
|
return port;
|
|
1946
1834
|
} });
|
|
1947
|
-
Object.defineProperty(this,
|
|
1835
|
+
Object.defineProperty(this, "type", { enumerable: true, configurable: false, get: function get() {
|
|
1948
1836
|
return type;
|
|
1949
1837
|
} });
|
|
1950
|
-
Object.defineProperty(this,
|
|
1838
|
+
Object.defineProperty(this, "tcpType", { enumerable: true, configurable: false, get: function get() {
|
|
1951
1839
|
return tcpType;
|
|
1952
1840
|
} });
|
|
1953
|
-
Object.defineProperty(this,
|
|
1841
|
+
Object.defineProperty(this, "relatedAddress", { enumerable: true, configurable: false, get: function get() {
|
|
1954
1842
|
return relatedAddress;
|
|
1955
1843
|
} });
|
|
1956
|
-
Object.defineProperty(this,
|
|
1844
|
+
Object.defineProperty(this, "relatedPort", { enumerable: true, configurable: false, get: function get() {
|
|
1957
1845
|
return relatedPort;
|
|
1958
1846
|
} });
|
|
1959
|
-
Object.defineProperty(this,
|
|
1847
|
+
Object.defineProperty(this, "usernameFragment", { enumerable: true, configurable: false, get: function get() {
|
|
1960
1848
|
return usernameFragment;
|
|
1961
1849
|
} });
|
|
1962
1850
|
|
|
@@ -1972,24 +1860,20 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
1972
1860
|
};
|
|
1973
1861
|
};
|
|
1974
1862
|
|
|
1975
|
-
Object.defineProperty(RTCIceCandidate, 'name', { enumerable: false, configurable: true, writable: false, value:
|
|
1863
|
+
Object.defineProperty(RTCIceCandidate, 'name', { enumerable: false, configurable: true, writable: false, value: "RTCIceCandidate" });
|
|
1976
1864
|
Object.defineProperty(RTCIceCandidate, 'prototype', { writable: false });
|
|
1977
1865
|
module.exports = RTCIceCandidate;
|
|
1978
|
-
}, {
|
|
1866
|
+
}, { "./WebRTCProxy.js": 17 }], 11: [function (require, module, exports) {
|
|
1979
1867
|
'use strict';
|
|
1980
1868
|
|
|
1981
1869
|
var _extends = Object.assign || function (target) {
|
|
1982
1870
|
for (var i = 1; i < arguments.length; i++) {
|
|
1983
|
-
var source = arguments[i];
|
|
1984
|
-
|
|
1985
|
-
for (var key in source) {
|
|
1871
|
+
var source = arguments[i];for (var key in source) {
|
|
1986
1872
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1987
1873
|
target[key] = source[key];
|
|
1988
1874
|
}
|
|
1989
1875
|
}
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
return target;
|
|
1876
|
+
}return target;
|
|
1993
1877
|
};
|
|
1994
1878
|
|
|
1995
1879
|
var WebRTCProxy = require('./WebRTCProxy.js');
|
|
@@ -2010,15 +1894,20 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2010
1894
|
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options);
|
|
2011
1895
|
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options);
|
|
2012
1896
|
Promise<void> setLocalDescription(RTCSessionDescriptionInit description);
|
|
2013
|
-
|
|
1897
|
+
|
|
1898
|
+
readonly attribute RTCSessionDescription? localDescription;
|
|
2014
1899
|
readonly attribute RTCSessionDescription? currentLocalDescription;
|
|
2015
1900
|
readonly attribute RTCSessionDescription? pendingLocalDescription;
|
|
2016
|
-
|
|
2017
|
-
|
|
1901
|
+
|
|
1902
|
+
Promise<void> setRemoteDescription(RTCSessionDescriptionInit description);
|
|
1903
|
+
|
|
1904
|
+
readonly attribute RTCSessionDescription? remoteDescription;
|
|
2018
1905
|
readonly attribute RTCSessionDescription? currentRemoteDescription;
|
|
2019
1906
|
readonly attribute RTCSessionDescription? pendingRemoteDescription;
|
|
2020
|
-
|
|
2021
|
-
|
|
1907
|
+
|
|
1908
|
+
Promise<void> addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate);
|
|
1909
|
+
|
|
1910
|
+
readonly attribute RTCSignalingState signalingState;
|
|
2022
1911
|
readonly attribute RTCIceGatheringState iceGatheringState;
|
|
2023
1912
|
readonly attribute RTCIceConnectionState iceConnectionState;
|
|
2024
1913
|
readonly attribute RTCPeerConnectionState connectionState;
|
|
@@ -2027,13 +1916,14 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2027
1916
|
RTCConfiguration getConfiguration();
|
|
2028
1917
|
void setConfiguration(RTCConfiguration configuration);
|
|
2029
1918
|
void close();
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
1919
|
+
|
|
1920
|
+
attribute EventHandler onnegotiationneeded;
|
|
1921
|
+
attribute EventHandler onicecandidate;
|
|
1922
|
+
attribute EventHandler onicecandidateerror;
|
|
1923
|
+
attribute EventHandler onsignalingstatechange;
|
|
1924
|
+
attribute EventHandler oniceconnectionstatechange;
|
|
1925
|
+
attribute EventHandler onicegatheringstatechange;
|
|
1926
|
+
attribute EventHandler onconnectionstatechange;
|
|
2037
1927
|
};
|
|
2038
1928
|
*/
|
|
2039
1929
|
|
|
@@ -2045,43 +1935,34 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2045
1935
|
//Check if a value is valid in an enum
|
|
2046
1936
|
function check(value, valid) {
|
|
2047
1937
|
for (var i = 0; i < valid.length; ++i) {
|
|
2048
|
-
if (valid[i] === value)
|
|
2049
|
-
return;
|
|
2050
|
-
}
|
|
1938
|
+
if (valid[i] === value) return;
|
|
2051
1939
|
}throw new TypeError(value + ' not in ' + JSON.stringify(valid));
|
|
2052
1940
|
}
|
|
2053
1941
|
|
|
2054
1942
|
function checkRange(value, min, max) {
|
|
2055
|
-
if (value < min || value > max)
|
|
2056
|
-
throw new TypeError(value + ' not in [' + min + ',' + max + ']');
|
|
2057
|
-
}
|
|
1943
|
+
if (value < min || value > max) throw new TypeError(value + ' not in [' + min + ',' + max + ']');
|
|
2058
1944
|
}
|
|
2059
1945
|
|
|
2060
1946
|
function checkNotNull(value) {
|
|
2061
|
-
if (value === null)
|
|
2062
|
-
throw new TypeError('Null not allowed');
|
|
2063
|
-
}
|
|
1947
|
+
if (value === null) throw new TypeError('Null not allowed');
|
|
2064
1948
|
}
|
|
2065
1949
|
|
|
2066
1950
|
function checkArray(value) {
|
|
2067
|
-
if (!Array.isArray(value))
|
|
2068
|
-
throw new TypeError('Must be an array');
|
|
2069
|
-
}
|
|
1951
|
+
if (!Array.isArray(value)) throw new TypeError('Must be an array');
|
|
2070
1952
|
}
|
|
2071
1953
|
|
|
2072
1954
|
function createRTCConfiguration(configuration) {
|
|
2073
|
-
|
|
2074
1955
|
/*
|
|
2075
|
-
|
|
1956
|
+
*
|
|
2076
1957
|
dictionary RTCConfiguration {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
1958
|
+
sequence<RTCIceServer> iceServers;
|
|
1959
|
+
RTCIceTransportPolicy iceTransportPolicy = "all";
|
|
1960
|
+
RTCBundlePolicy bundlePolicy = "balanced";
|
|
1961
|
+
RTCRtcpMuxPolicy rtcpMuxPolicy = "require";
|
|
1962
|
+
DOMString peerIdentity;
|
|
1963
|
+
sequence<RTCCertificate> certificates;
|
|
1964
|
+
[EnforceRange]
|
|
1965
|
+
octet iceCandidatePoolSize = 0;
|
|
2085
1966
|
};
|
|
2086
1967
|
*/
|
|
2087
1968
|
//Set configuration with default values
|
|
@@ -2096,36 +1977,31 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2096
1977
|
//Remove undefined objects
|
|
2097
1978
|
configuration ? JSON.parse(JSON.stringify(configuration)) : {});
|
|
2098
1979
|
//Check valid values
|
|
2099
|
-
|
|
2100
1980
|
checkNotNull(sanitized.iceServers);
|
|
2101
1981
|
|
|
2102
1982
|
//Check array
|
|
2103
1983
|
if (Array.isArray(sanitized.iceServers)) {
|
|
2104
1984
|
//Check each one
|
|
2105
1985
|
for (var i = 0; i < sanitized.iceServers.length; ++i) {
|
|
2106
|
-
|
|
2107
1986
|
/*
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
1987
|
+
*
|
|
1988
|
+
dictionary RTCIceServer {
|
|
1989
|
+
required (DOMString or sequence<DOMString>) urls;
|
|
1990
|
+
DOMString username;
|
|
1991
|
+
(DOMString or RTCOAuthCredential) credential;
|
|
1992
|
+
RTCIceCredentialType credentialType = "password";
|
|
2114
1993
|
};
|
|
2115
|
-
|
|
1994
|
+
*/
|
|
2116
1995
|
//Set defautls
|
|
2117
1996
|
var iceServer = sanitized.iceServers[i] = _extends({
|
|
2118
1997
|
credentialType: 'password'
|
|
2119
1998
|
}, sanitized.iceServers[i]);
|
|
2120
1999
|
//Check it is not null
|
|
2121
|
-
|
|
2122
2000
|
checkNotNull(iceServer.urls);
|
|
2123
2001
|
//If it is a sring fallback
|
|
2124
2002
|
if (typeof iceServer.urls === 'string')
|
|
2125
2003
|
//Arraify
|
|
2126
|
-
|
|
2127
|
-
iceServer.urls = [iceServer.urls];
|
|
2128
|
-
}
|
|
2004
|
+
iceServer.urls = [iceServer.urls];
|
|
2129
2005
|
checkArray(iceServer.urls);
|
|
2130
2006
|
}
|
|
2131
2007
|
}
|
|
@@ -2141,7 +2017,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2141
2017
|
var RTCPeerConnection = function RTCPeerConnection() {
|
|
2142
2018
|
var self = this;
|
|
2143
2019
|
//Init event targetr
|
|
2144
|
-
|
|
2145
2020
|
EventTarget.call(this);
|
|
2146
2021
|
|
|
2147
2022
|
//Create private args
|
|
@@ -2171,50 +2046,71 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2171
2046
|
|
|
2172
2047
|
//Define read only properties for each attribute
|
|
2173
2048
|
//The localDescription attribute must return pendingLocalDescription if it is not null and otherwise it must return currentLocalDescription .
|
|
2174
|
-
Object.defineProperty(this, 'localDescription', {
|
|
2049
|
+
Object.defineProperty(this, 'localDescription', {
|
|
2050
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2175
2051
|
return toSessionDescription(priv.pc.localDescription);
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
Object.defineProperty(this, 'currentLocalDescription', {
|
|
2055
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2178
2056
|
return toSessionDescription(priv.pc.currentLocalDescription);
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
Object.defineProperty(this, 'pendingLocalDescription', {
|
|
2060
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2181
2061
|
return toSessionDescription(priv.pc.pendingLocalDescription);
|
|
2182
|
-
}
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2183
2064
|
|
|
2184
|
-
Object.defineProperty(this, 'remoteDescription', {
|
|
2065
|
+
Object.defineProperty(this, 'remoteDescription', {
|
|
2066
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2185
2067
|
return toSessionDescription(priv.pc.remoteDescription);
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
Object.defineProperty(this, 'currentRemoteDescription', {
|
|
2071
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2188
2072
|
return toSessionDescription(priv.pc.currentRemoteDescription);
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
Object.defineProperty(this, 'pendingRemoteDescription', {
|
|
2076
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2191
2077
|
return toSessionDescription(priv.pc.pendingRemoteDescription);
|
|
2192
|
-
}
|
|
2078
|
+
}
|
|
2079
|
+
});
|
|
2193
2080
|
|
|
2194
|
-
Object.defineProperty(this, 'signalingState', {
|
|
2081
|
+
Object.defineProperty(this, 'signalingState', {
|
|
2082
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2195
2083
|
return signalingState;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
2086
|
+
Object.defineProperty(this, 'iceGatheringState', {
|
|
2087
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2198
2088
|
return iceGatheringState;
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
Object.defineProperty(this, 'iceConnectionState', {
|
|
2092
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2201
2093
|
return iceConnectionState;
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2094
|
+
}
|
|
2095
|
+
});
|
|
2096
|
+
Object.defineProperty(this, 'connectionState', {
|
|
2097
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2204
2098
|
return connectionState;
|
|
2205
|
-
}
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2206
2101
|
|
|
2207
|
-
Object.defineProperty(this, 'canTrickleIceCandidates', {
|
|
2102
|
+
Object.defineProperty(this, 'canTrickleIceCandidates', {
|
|
2103
|
+
enumerable: true, configurable: false, get: function get() {
|
|
2208
2104
|
return canTrickleIceCandidates;
|
|
2209
|
-
}
|
|
2105
|
+
}
|
|
2106
|
+
});
|
|
2210
2107
|
|
|
2211
2108
|
function createEvent(name) {
|
|
2212
2109
|
var e = document.createEvent('Event');
|
|
2213
|
-
|
|
2214
2110
|
e.initEvent(name, false, false);
|
|
2215
|
-
|
|
2216
2111
|
return e;
|
|
2217
2112
|
}
|
|
2113
|
+
|
|
2218
2114
|
function fire(name) {
|
|
2219
2115
|
self.dispatchEvent(createEvent(name));
|
|
2220
2116
|
}
|
|
@@ -2228,29 +2124,24 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2228
2124
|
};
|
|
2229
2125
|
priv.pc.onicecandidate = function (candidate, sdpMid, sdpMLineIndex, foundation, component, priority, ip, protocol, port, type, tcpType, relatedAddress, relatedPort, usernameFragment, url) {
|
|
2230
2126
|
var e = createEvent('icecandidate');
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
usernameFragment: usernameFragment
|
|
2250
|
-
});
|
|
2251
|
-
} else {
|
|
2252
|
-
e.candidate = null;
|
|
2253
|
-
}
|
|
2127
|
+
if (candidate) e.candidate = new RTCIceCandidate({
|
|
2128
|
+
candidate: candidate,
|
|
2129
|
+
sdpMid: sdpMid,
|
|
2130
|
+
sdpMLineIndex: sdpMLineIndex,
|
|
2131
|
+
ext: {
|
|
2132
|
+
foundation: foundation,
|
|
2133
|
+
component: component,
|
|
2134
|
+
priority: priority,
|
|
2135
|
+
ip: ip,
|
|
2136
|
+
protocol: protocol,
|
|
2137
|
+
port: port,
|
|
2138
|
+
type: type,
|
|
2139
|
+
tcpType: tcpType,
|
|
2140
|
+
relatedAddress: relatedAddress,
|
|
2141
|
+
relatedPort: relatedPort
|
|
2142
|
+
},
|
|
2143
|
+
usernameFragment: usernameFragment
|
|
2144
|
+
});else e.candidate = null;
|
|
2254
2145
|
e.url = url;
|
|
2255
2146
|
self.dispatchEvent(e);
|
|
2256
2147
|
};
|
|
@@ -2260,7 +2151,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2260
2151
|
priv.pc.onsignalingstatechange = function (state) {
|
|
2261
2152
|
signalingState = state;
|
|
2262
2153
|
fire('signalingstatechange');
|
|
2263
|
-
if (
|
|
2154
|
+
if ('closed' === state) {
|
|
2264
2155
|
priv.isClosed = true;
|
|
2265
2156
|
delete priv.pc;
|
|
2266
2157
|
}
|
|
@@ -2298,7 +2189,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2298
2189
|
//Create evnet
|
|
2299
2190
|
var event = createEvent('track');
|
|
2300
2191
|
//Add data
|
|
2301
|
-
|
|
2302
2192
|
event.track = mediaStreamTracks[i];
|
|
2303
2193
|
event.receiver = { track: mediaStreamTracks[i] };
|
|
2304
2194
|
event.transceiver = { receiver: event.receiver };
|
|
@@ -2318,7 +2208,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2318
2208
|
//Create event
|
|
2319
2209
|
var event = createEvent('datachannel');
|
|
2320
2210
|
//Create datachannel
|
|
2321
|
-
|
|
2322
2211
|
event.channel = new DataChannel(dataChannel);
|
|
2323
2212
|
//Fire event
|
|
2324
2213
|
self.dispatchEvent(event);
|
|
@@ -2351,10 +2240,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2351
2240
|
|
|
2352
2241
|
RTCPeerConnection.prototype.setConfiguration = function (configuration) {
|
|
2353
2242
|
var priv = this.priv;
|
|
2354
|
-
|
|
2355
|
-
if (!priv.pc || priv.isClosed) {
|
|
2356
|
-
throw new InvalidStateError();
|
|
2357
|
-
}
|
|
2243
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2358
2244
|
|
|
2359
2245
|
//Get configuration object from input
|
|
2360
2246
|
var sanitized = createRTCConfiguration(configuration);
|
|
@@ -2365,7 +2251,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2365
2251
|
} catch (error) {
|
|
2366
2252
|
//Launch InvalidModificationError
|
|
2367
2253
|
var operationError = new Error(error);
|
|
2368
|
-
|
|
2369
2254
|
operationError.name = 'InvalidModificationError';
|
|
2370
2255
|
operationError.code = 13;
|
|
2371
2256
|
throw operationError;
|
|
@@ -2382,9 +2267,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2382
2267
|
var priv = this.priv;
|
|
2383
2268
|
|
|
2384
2269
|
return new Promise(function (resolve, reject) {
|
|
2385
|
-
if (!priv.pc || priv.isClosed)
|
|
2386
|
-
throw new InvalidStateError();
|
|
2387
|
-
}
|
|
2270
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2388
2271
|
priv.pc.createOffer(function (type, sdp) {
|
|
2389
2272
|
priv.lastOffer = sdp;
|
|
2390
2273
|
resolve({
|
|
@@ -2402,12 +2285,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2402
2285
|
var priv = this.priv;
|
|
2403
2286
|
|
|
2404
2287
|
return new Promise(function (resolve, reject) {
|
|
2405
|
-
if (!priv.pc || priv.isClosed)
|
|
2406
|
-
|
|
2407
|
-
}
|
|
2408
|
-
if (self.remoteDescription === null) {
|
|
2409
|
-
throw new InvalidStateError();
|
|
2410
|
-
}
|
|
2288
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2289
|
+
if (self.remoteDescription === null) throw new InvalidStateError();
|
|
2411
2290
|
priv.pc.createAnswer(function (type, sdp) {
|
|
2412
2291
|
priv.lastAnswer = sdp;
|
|
2413
2292
|
resolve({
|
|
@@ -2424,19 +2303,13 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2424
2303
|
var priv = this.priv;
|
|
2425
2304
|
|
|
2426
2305
|
//If description.sdp is the empty string and description.type is "answer" or "pranswer", set description.sdp to lastAnswer.
|
|
2427
|
-
if (!description.sdp && (
|
|
2428
|
-
description.sdp = priv.lastAnswer;
|
|
2429
|
-
}
|
|
2306
|
+
if (!description.sdp && ('answer' === description.type || 'pranser' === description.type)) description.sdp = priv.lastAnswer;
|
|
2430
2307
|
|
|
2431
2308
|
//If description.sdp is the empty string and description.type is "offer", set description.sdp to lastOffer.
|
|
2432
|
-
if (!description.sdp && description.type
|
|
2433
|
-
description.sdp = priv.lastOffer;
|
|
2434
|
-
}
|
|
2309
|
+
if (!description.sdp && 'offer' === description.type) description.sdp = priv.lastOffer;
|
|
2435
2310
|
|
|
2436
2311
|
return new Promise(function (resolve, reject) {
|
|
2437
|
-
if (!priv.pc || priv.isClosed)
|
|
2438
|
-
throw new InvalidStateError();
|
|
2439
|
-
}
|
|
2312
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2440
2313
|
priv.pc.setLocalDescription(resolve, function () {
|
|
2441
2314
|
reject(new InvalidStateError());
|
|
2442
2315
|
}, description);
|
|
@@ -2447,9 +2320,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2447
2320
|
var priv = this.priv;
|
|
2448
2321
|
|
|
2449
2322
|
return new Promise(function (resolve, reject) {
|
|
2450
|
-
if (!priv.pc || priv.isClosed)
|
|
2451
|
-
throw new InvalidStateError();
|
|
2452
|
-
}
|
|
2323
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2453
2324
|
priv.pc.setRemoteDescription(resolve, function () {
|
|
2454
2325
|
reject(new InvalidStateError());
|
|
2455
2326
|
}, description);
|
|
@@ -2462,34 +2333,29 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2462
2333
|
//1. Let candidate be the method's argument.
|
|
2463
2334
|
//2. Let connection be the ``[`RTCPeerConnection`](#dom-rtcpeerconnection)`` object on which the method was invoked.
|
|
2464
2335
|
//3. If both sdpMid and sdpMLineIndex are `null`, return a promise [rejected](#dfn-rejected) with a newly [created](https://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#dfn-create-exception) `TypeError`.
|
|
2465
|
-
|
|
2466
|
-
if (!candidate || typeof candidate.sdpMid !== 'string' && typeof candidate.sdpMLineIndex !== 'number') {
|
|
2467
|
-
return Promise.reject(new TypeError());
|
|
2468
|
-
}
|
|
2336
|
+
if (!candidate || typeof candidate.sdpMid !== 'string' && typeof candidate.sdpMLineIndex !== 'number') return Promise.reject(new TypeError());
|
|
2469
2337
|
|
|
2470
2338
|
//4. Return the result of [enqueuing](#enqueue-an-operation) the following steps to connection's operation queue:
|
|
2471
2339
|
return new Promise(function (resolve, reject) {
|
|
2472
2340
|
//1. If ``[`remoteDescription`](#dom-rtcpeerconnection-remotedescription)`` is `null` return a promise [rejected](#dfn-rejected) with a newly [created](https://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#dfn-create-exception) `InvalidStateError`.
|
|
2473
|
-
if (self.remoteDescription === null)
|
|
2474
|
-
throw new InvalidStateError();
|
|
2475
|
-
}
|
|
2341
|
+
if (self.remoteDescription === null) throw new InvalidStateError();
|
|
2476
2342
|
|
|
2477
2343
|
/*
|
|
2478
2344
|
2. Let p be a new promise.
|
|
2479
2345
|
3. If candidate.sdpMid is not null, run the following steps:
|
|
2480
|
-
|
|
2346
|
+
1. If candidate.sdpMid is not equal to the mid of any media description in ``[`remoteDescription`](#dom-rtcpeerconnection-remotedescription)`` , [reject](#dfn-rejected) p with a newly [created](https://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#dfn-create-exception) `OperationError` and abort these steps.
|
|
2481
2347
|
4. Else, if candidate.sdpMLineIndex is not null, run the following steps:
|
|
2482
|
-
|
|
2348
|
+
1. If candidate.sdpMLineIndex is equal to or larger than the number of media descriptions in ``[`remoteDescription`](#dom-rtcpeerconnection-remotedescription)`` , [reject](#dfn-rejected) p with a newly [created](https://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#dfn-create-exception) `OperationError` and abort these steps.
|
|
2483
2349
|
5. If `candidate.usernameFragment` is neither `undefined` nor `null`, and is not equal to any username fragment present in the corresponding [media description](#dfn-media-description) of an applied remote description, [reject](#dfn-rejected) p with a newly [created](https://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#dfn-create-exception) `OperationError` and abort these steps.
|
|
2484
2350
|
6. In parallel, add the ICE candidate candidate as described in \[[JSEP](#bib-JSEP)\] ([section 4.1.17.](https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-4.1.17)). Use `candidate.usernameFragment` to identify the ICE [generation](#dfn-generation); if `usernameFragment` is null, process the candidate for the most recent ICE [generation](#dfn-generation). If `candidate.candidate` is an empty string, process candidate as an end-of-candidates indication for the corresponding [media description](#dfn-media-description) and ICE candidate [generation](#dfn-generation).
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2351
|
+
1. If candidate could not be successfully added the user agent _MUST_ queue a task that runs the following steps:
|
|
2352
|
+
1. If connection's [\[\[IsClosed\]\]](#dfn-x%5B%5Bisclosed%5D%5D) slot is `true`, then abort these steps.
|
|
2353
|
+
2. [Reject](#dfn-rejected) p with a `DOMException` object whose `name` attribute has the value `OperationError` and abort these steps.
|
|
2354
|
+
2. If candidate is applied successfully, the user agent _MUST_ queue a task that runs the following steps:
|
|
2355
|
+
1. If connection's [\[\[IsClosed\]\]](#dfn-x%5B%5Bisclosed%5D%5D) slot is `true`, then abort these steps.
|
|
2356
|
+
2. If ``connection.[`pendingRemoteDescription`](#dom-rtcpeerconnection-pendingremotedescription)`` is non-null, and represents the ICE [generation](#dfn-generation) for which candidate was processed, add candidate to ``connection.[`pendingRemoteDescription`](#dom-rtcpeerconnection-pendingremotedescription)`` .
|
|
2357
|
+
3. If ``connection.[`currentRemoteDescription`](#dom-rtcpeerconnection-currentremotedescription)`` is non-null, and represents the ICE [generation](#dfn-generation) for which candidate was processed, add candidate to ``connection.[`currentRemoteDescription`](#dom-rtcpeerconnection-currentremotedescription)`` .
|
|
2358
|
+
4. [Resolve](#dfn-resolved) p with `undefined`.
|
|
2493
2359
|
7. Return p.
|
|
2494
2360
|
*/
|
|
2495
2361
|
try {
|
|
@@ -2500,7 +2366,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2500
2366
|
} catch (error) {
|
|
2501
2367
|
//Launch operation error
|
|
2502
2368
|
var operationError = new Error(error);
|
|
2503
|
-
|
|
2504
2369
|
operationError.name = 'OperationError';
|
|
2505
2370
|
operationError.code = 0;
|
|
2506
2371
|
throw operationError;
|
|
@@ -2511,10 +2376,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2511
2376
|
RTCPeerConnection.prototype.close = function () {
|
|
2512
2377
|
|
|
2513
2378
|
var priv = this.priv;
|
|
2514
|
-
|
|
2515
|
-
if (!priv.pc || priv.isClosed) {
|
|
2516
|
-
throw new InvalidStateError();
|
|
2517
|
-
}
|
|
2379
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2518
2380
|
//Close it
|
|
2519
2381
|
priv.pc.close();
|
|
2520
2382
|
//We are closed now, we can wait until callback
|
|
@@ -2547,18 +2409,14 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2547
2409
|
RTCPeerConnection.prototype.addTrack = function () {
|
|
2548
2410
|
var priv = this.priv;
|
|
2549
2411
|
|
|
2550
|
-
if (!priv.pc || priv.isClosed)
|
|
2551
|
-
throw new InvalidStateError();
|
|
2552
|
-
}
|
|
2412
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2553
2413
|
|
|
2554
2414
|
//Parse arguments
|
|
2555
2415
|
var track = arguments[0];
|
|
2556
2416
|
var streams = Array.prototype.slice.call(arguments, 1);
|
|
2557
2417
|
|
|
2558
2418
|
//Ensure that we are attaching to at most 1, as it is not supported in libwebrtc
|
|
2559
|
-
if (streams.length > 1)
|
|
2560
|
-
throw new Error('Adding track to more than one stream is not currently supported');
|
|
2561
|
-
}
|
|
2419
|
+
if (streams.length > 1) throw new Error('Adding track to more than one stream is not currently supported');
|
|
2562
2420
|
|
|
2563
2421
|
//Get stream label, as it is the only param needed by libwebrtc
|
|
2564
2422
|
var label = streams.length ? streams[0].id : '';
|
|
@@ -2567,9 +2425,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2567
2425
|
var sender = priv.pc.addTrack(track.priv.track, label);
|
|
2568
2426
|
|
|
2569
2427
|
//Check result
|
|
2570
|
-
if (!sender)
|
|
2571
|
-
return null;
|
|
2572
|
-
}
|
|
2428
|
+
if (!sender) return null;
|
|
2573
2429
|
|
|
2574
2430
|
//Create sender
|
|
2575
2431
|
var rtpSender = new RTCRtpSender(sender);
|
|
@@ -2590,16 +2446,18 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2590
2446
|
var track = new MediaStreamTrack(null);
|
|
2591
2447
|
var receiver = new RTCRtpReceiver(track);
|
|
2592
2448
|
//Return dummy object for now
|
|
2593
|
-
|
|
2594
2449
|
return new RTCRtpTransceiver(sender, receiver);
|
|
2595
2450
|
};
|
|
2596
2451
|
|
|
2452
|
+
RTCPeerConnection.prototype.getStats = function () {
|
|
2453
|
+
return Promise.resolve({});
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2597
2456
|
/*
|
|
2598
2457
|
* Legacy stream apis
|
|
2599
2458
|
*/
|
|
2600
2459
|
RTCPeerConnection.prototype.addStream = function (stream) {
|
|
2601
2460
|
var tracks = stream.getTracks();
|
|
2602
|
-
|
|
2603
2461
|
for (var i = 0; i < tracks.length; ++i) {
|
|
2604
2462
|
this.addTrack(tracks[i], stream);
|
|
2605
2463
|
}
|
|
@@ -2608,22 +2466,16 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2608
2466
|
RTCPeerConnection.prototype.removeTrack = function (rtpSender) {
|
|
2609
2467
|
var priv = this.priv;
|
|
2610
2468
|
|
|
2611
|
-
if (!priv.pc || priv.isClosed)
|
|
2612
|
-
throw new InvalidStateError();
|
|
2613
|
-
}
|
|
2469
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2614
2470
|
|
|
2615
2471
|
//Check if sender is invalid
|
|
2616
|
-
if (!rtpSender || !rtpSender.priv.sender || !rtpSender.priv.track)
|
|
2617
|
-
throw new InvalidStateError();
|
|
2618
|
-
}
|
|
2472
|
+
if (!rtpSender || !rtpSender.priv.sender || !rtpSender.priv.track) throw new InvalidStateError();
|
|
2619
2473
|
|
|
2620
2474
|
//Get native sender id
|
|
2621
2475
|
var senderId = rtpSender.priv.id;
|
|
2622
2476
|
|
|
2623
2477
|
//Check if senders is from this pc
|
|
2624
|
-
if (!priv.senders.hasOwnProperty(senderId))
|
|
2625
|
-
throw new InvalidStateError();
|
|
2626
|
-
}
|
|
2478
|
+
if (!priv.senders.hasOwnProperty(senderId)) throw new InvalidStateError();
|
|
2627
2479
|
|
|
2628
2480
|
//Pass the nateive object
|
|
2629
2481
|
priv.pc.removeTrack(rtpSender.priv.sender);
|
|
@@ -2648,22 +2500,16 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2648
2500
|
RTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {
|
|
2649
2501
|
var priv = this.priv;
|
|
2650
2502
|
|
|
2651
|
-
if (!priv.pc || priv.isClosed)
|
|
2652
|
-
throw new InvalidStateError();
|
|
2653
|
-
}
|
|
2503
|
+
if (!priv.pc || priv.isClosed) throw new InvalidStateError();
|
|
2654
2504
|
|
|
2655
2505
|
//Check if we have a string label (can be empty)
|
|
2656
|
-
if (typeof label !== 'string')
|
|
2657
|
-
return new TypeError();
|
|
2658
|
-
}
|
|
2506
|
+
if (typeof label !== 'string') return new TypeError();
|
|
2659
2507
|
|
|
2660
2508
|
//Create native datachannel
|
|
2661
2509
|
var dataChannel = priv.pc.createDataChannel(label, dataChannelDict);
|
|
2662
2510
|
|
|
2663
2511
|
//Check
|
|
2664
|
-
if (!dataChannel)
|
|
2665
|
-
return null;
|
|
2666
|
-
}
|
|
2512
|
+
if (!dataChannel) return null;
|
|
2667
2513
|
|
|
2668
2514
|
//Return wrapper
|
|
2669
2515
|
return new DataChannel(dataChannel);
|
|
@@ -2671,10 +2517,15 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2671
2517
|
|
|
2672
2518
|
defineEventAttribute(RTCPeerConnection.prototype, 'datachannel');
|
|
2673
2519
|
|
|
2674
|
-
Object.defineProperty(RTCPeerConnection, 'RTCPeerConnection', {
|
|
2520
|
+
Object.defineProperty(RTCPeerConnection, 'RTCPeerConnection', {
|
|
2521
|
+
enumerable: false,
|
|
2522
|
+
configurable: true,
|
|
2523
|
+
writable: false,
|
|
2524
|
+
value: 'RTCPeerConnection'
|
|
2525
|
+
});
|
|
2675
2526
|
Object.defineProperty(RTCPeerConnection, 'prototype', { writable: false });
|
|
2676
2527
|
module.exports = RTCPeerConnection;
|
|
2677
|
-
}, {
|
|
2528
|
+
}, { "./EventTarget.js": 4, "./InvalidStateError.js": 5, "./MediaStreamTrack.js": 8, "./RTCDataChannel.js": 9, "./RTCIceCandidate.js": 10, "./RTCRtpReceiver.js": 12, "./RTCRtpSender.js": 13, "./RTCRtpTransceiver.js": 14, "./RTCSessionDescription.js": 15, "./WebRTCProxy.js": 17 }], 12: [function (require, module, exports) {
|
|
2678
2529
|
'use strict';
|
|
2679
2530
|
|
|
2680
2531
|
/*
|
|
@@ -2690,7 +2541,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2690
2541
|
sequence<RTCRtpSynchronizationSource> getSynchronizationSources();
|
|
2691
2542
|
Promise<RTCStatsReport> getStats();
|
|
2692
2543
|
};
|
|
2693
|
-
|
|
2544
|
+
|
|
2545
|
+
*/
|
|
2694
2546
|
|
|
2695
2547
|
var RTCRtpReceiver = function RTCRtpReceiver(track) {
|
|
2696
2548
|
var priv = {
|
|
@@ -2771,40 +2623,40 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2771
2623
|
return priv.track;
|
|
2772
2624
|
} });
|
|
2773
2625
|
Object.defineProperty(this, 'transport', { enumerable: true, configurable: false, get: function get() {
|
|
2774
|
-
new Error(
|
|
2626
|
+
new Error("Not supported yet");
|
|
2775
2627
|
} });
|
|
2776
2628
|
Object.defineProperty(this, 'rtcpTransport', { enumerable: true, configurable: false, get: function get() {
|
|
2777
|
-
new Error(
|
|
2629
|
+
new Error("Not supported yet");
|
|
2778
2630
|
} });
|
|
2779
2631
|
|
|
2780
2632
|
return this;
|
|
2781
2633
|
};
|
|
2782
2634
|
|
|
2783
2635
|
RTCRtpSender.prototype.getCapabilities = function () {
|
|
2784
|
-
throw new Error(
|
|
2636
|
+
throw new Error("Not supported yet");
|
|
2785
2637
|
};
|
|
2786
2638
|
|
|
2787
2639
|
RTCRtpSender.prototype.setParameters = function () {
|
|
2788
|
-
throw new Error(
|
|
2640
|
+
throw new Error("Not supported yet");
|
|
2789
2641
|
};
|
|
2790
2642
|
|
|
2791
2643
|
RTCRtpSender.prototype.getParameters = function () {
|
|
2792
|
-
throw new Error(
|
|
2644
|
+
throw new Error("Not supported yet");
|
|
2793
2645
|
};
|
|
2794
2646
|
|
|
2795
2647
|
RTCRtpSender.prototype.replaceTrack = function () {
|
|
2796
|
-
throw new Error(
|
|
2648
|
+
throw new Error("Not supported yet");
|
|
2797
2649
|
};
|
|
2798
2650
|
|
|
2799
2651
|
RTCRtpSender.prototype.getStats = function () {
|
|
2800
|
-
throw new Error(
|
|
2652
|
+
throw new Error("Not supported yet");
|
|
2801
2653
|
};
|
|
2802
2654
|
|
|
2803
|
-
Object.defineProperty(RTCRtpSender, 'name', { enumerable: false, configurable: true, writable: false, value:
|
|
2655
|
+
Object.defineProperty(RTCRtpSender, 'name', { enumerable: false, configurable: true, writable: false, value: "RTCRtpSender" });
|
|
2804
2656
|
Object.defineProperty(RTCRtpSender, 'prototype', { writable: false });
|
|
2805
2657
|
module.exports = RTCRtpSender;
|
|
2806
2658
|
}, {}], 14: [function (require, module, exports) {
|
|
2807
|
-
|
|
2659
|
+
"use strict";
|
|
2808
2660
|
|
|
2809
2661
|
/*
|
|
2810
2662
|
[Exposed=Window]
|
|
@@ -2820,7 +2672,8 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2820
2672
|
void stop();
|
|
2821
2673
|
void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
|
|
2822
2674
|
};
|
|
2823
|
-
|
|
2675
|
+
|
|
2676
|
+
*/
|
|
2824
2677
|
|
|
2825
2678
|
var RTPRtcTransceiver = function RTPRtcTransceiver(sender, receiver) {
|
|
2826
2679
|
|
|
@@ -2830,50 +2683,49 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2830
2683
|
sender: sender,
|
|
2831
2684
|
receiver: receiver,
|
|
2832
2685
|
stopped: false,
|
|
2833
|
-
direction:
|
|
2834
|
-
currentDirection:
|
|
2686
|
+
direction: "sendrecv",
|
|
2687
|
+
currentDirection: "sendrecv"
|
|
2835
2688
|
};
|
|
2836
2689
|
|
|
2837
2690
|
//Read only
|
|
2838
|
-
Object.defineProperty(this,
|
|
2691
|
+
Object.defineProperty(this, "mid", { enumerable: true, configurable: false, get: function get() {
|
|
2839
2692
|
return priv.mid;
|
|
2840
2693
|
} });
|
|
2841
|
-
Object.defineProperty(this,
|
|
2694
|
+
Object.defineProperty(this, "sender", { enumerable: true, configurable: false, get: function get() {
|
|
2842
2695
|
return priv.sender;
|
|
2843
2696
|
} });
|
|
2844
|
-
Object.defineProperty(this,
|
|
2697
|
+
Object.defineProperty(this, "receiver", { enumerable: true, configurable: false, get: function get() {
|
|
2845
2698
|
return priv.receiver;
|
|
2846
2699
|
} });
|
|
2847
|
-
Object.defineProperty(this,
|
|
2700
|
+
Object.defineProperty(this, "stopped", { enumerable: true, configurable: false, get: function get() {
|
|
2848
2701
|
return priv.stopped;
|
|
2849
2702
|
} });
|
|
2850
|
-
Object.defineProperty(this,
|
|
2703
|
+
Object.defineProperty(this, "currentDirection", { enumerable: true, configurable: false, get: function get() {
|
|
2851
2704
|
return priv.currentDirection;
|
|
2852
2705
|
} });
|
|
2853
2706
|
|
|
2854
2707
|
//REad and write
|
|
2855
|
-
Object.defineProperty(this,
|
|
2708
|
+
Object.defineProperty(this, "currentDirection", { enumerable: true, configurable: false,
|
|
2856
2709
|
get: function get() {
|
|
2857
2710
|
return priv.direction;
|
|
2858
2711
|
},
|
|
2859
2712
|
set: function set(direction) {
|
|
2860
2713
|
priv.direction = direction;
|
|
2861
2714
|
priv.currentDirection = direction;
|
|
2862
|
-
|
|
2863
2715
|
return direction;
|
|
2864
2716
|
}
|
|
2865
2717
|
});
|
|
2866
2718
|
};
|
|
2867
2719
|
|
|
2868
2720
|
RTPRtcTransceiver.prototype.stop = function () {
|
|
2869
|
-
throw
|
|
2721
|
+
throw "Not implemented";
|
|
2870
2722
|
};
|
|
2871
2723
|
|
|
2872
|
-
Object.defineProperty(RTPRtcTransceiver, 'name', { enumerable: false, configurable: true, writable: false, value:
|
|
2724
|
+
Object.defineProperty(RTPRtcTransceiver, 'name', { enumerable: false, configurable: true, writable: false, value: "RTPRtcTransceiver" });
|
|
2873
2725
|
Object.defineProperty(RTPRtcTransceiver, 'prototype', { writable: false });
|
|
2874
2726
|
module.exports = RTPRtcTransceiver;
|
|
2875
2727
|
}, {}], 15: [function (require, module, exports) {
|
|
2876
|
-
|
|
2728
|
+
"use strict";
|
|
2877
2729
|
|
|
2878
2730
|
/*
|
|
2879
2731
|
[Constructor(RTCSessionDescriptionInit descriptionInitDict),
|
|
@@ -2882,12 +2734,14 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2882
2734
|
readonly attribute RTCSdpType type;
|
|
2883
2735
|
readonly attribute DOMString sdp;
|
|
2884
2736
|
[Default] object toJSON();
|
|
2885
|
-
};
|
|
2886
|
-
|
|
2737
|
+
};
|
|
2738
|
+
|
|
2739
|
+
dictionary RTCSessionDescriptionInit {
|
|
2887
2740
|
required RTCSdpType type;
|
|
2888
2741
|
DOMString sdp = "";
|
|
2889
2742
|
};
|
|
2890
|
-
|
|
2743
|
+
|
|
2744
|
+
*/
|
|
2891
2745
|
|
|
2892
2746
|
function RTCSessionDescription(descriptionInitDict) {
|
|
2893
2747
|
//Get values from dictionary
|
|
@@ -2896,15 +2750,15 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2896
2750
|
var sdp = Array.isArray(descriptionInitDict) ? descriptionInitDict[1] : descriptionInitDict.sdp;
|
|
2897
2751
|
|
|
2898
2752
|
//Direct attributes from init
|
|
2899
|
-
Object.defineProperty(this,
|
|
2753
|
+
Object.defineProperty(this, "type", { enumerable: true, configurable: false, get: function get() {
|
|
2900
2754
|
return type;
|
|
2901
2755
|
} });
|
|
2902
|
-
Object.defineProperty(this,
|
|
2756
|
+
Object.defineProperty(this, "sdp", { enumerable: true, configurable: false, get: function get() {
|
|
2903
2757
|
return sdp;
|
|
2904
2758
|
} });
|
|
2905
2759
|
|
|
2906
2760
|
return this;
|
|
2907
|
-
}
|
|
2761
|
+
};
|
|
2908
2762
|
|
|
2909
2763
|
RTCSessionDescription.prototype.toJSON = function () {
|
|
2910
2764
|
return {
|
|
@@ -2913,11 +2767,11 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2913
2767
|
};
|
|
2914
2768
|
};
|
|
2915
2769
|
|
|
2916
|
-
Object.defineProperty(RTCSessionDescription, 'name', { enumerable: false, configurable: true, writable: false, value:
|
|
2770
|
+
Object.defineProperty(RTCSessionDescription, 'name', { enumerable: false, configurable: true, writable: false, value: "RTCSessionDescription" });
|
|
2917
2771
|
Object.defineProperty(RTCSessionDescription, 'prototype', { writable: false });
|
|
2918
2772
|
module.exports = RTCSessionDescription;
|
|
2919
2773
|
}, {}], 16: [function (require, module, exports) {
|
|
2920
|
-
|
|
2774
|
+
"use strict";
|
|
2921
2775
|
|
|
2922
2776
|
// This obvserver checks when a video element has been set a srcObj
|
|
2923
2777
|
|
|
@@ -2925,26 +2779,21 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2925
2779
|
for (var i = 0, numMutations = mutations.length; i < numMutations; i++) {
|
|
2926
2780
|
var mutation = mutations[i];
|
|
2927
2781
|
// HTML video element.
|
|
2928
|
-
|
|
2929
|
-
if (mutation.target.videoRenderer) {
|
|
2930
|
-
mutation.target.videoRenderer.mutate(mutation);
|
|
2931
|
-
}
|
|
2782
|
+
if (mutation.target.videoRenderer) mutation.target.videoRenderer.mutate(mutation);
|
|
2932
2783
|
}
|
|
2933
2784
|
});
|
|
2934
2785
|
|
|
2935
|
-
var CLASSID =
|
|
2786
|
+
var CLASSID = "CLSID:B8E874D9-72BA-4E54-B59B-3513081DF516";
|
|
2936
2787
|
|
|
2937
2788
|
function VideoRenderer(video) {
|
|
2938
2789
|
var srcObject;
|
|
2939
2790
|
var self = this;
|
|
2940
2791
|
//Store video element
|
|
2941
|
-
|
|
2942
2792
|
this.video = video;
|
|
2943
2793
|
|
|
2944
2794
|
//Create a new video renderer object
|
|
2945
|
-
var object = this.object = document.createElement(
|
|
2795
|
+
var object = this.object = document.createElement("object");
|
|
2946
2796
|
//Set csid
|
|
2947
|
-
|
|
2948
2797
|
this.object.classid = CLASSID;
|
|
2949
2798
|
//Apped it hidden
|
|
2950
2799
|
video.appendChild(this.object);
|
|
@@ -2981,13 +2830,11 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2981
2830
|
//We need to fire metadata event when we get first resize
|
|
2982
2831
|
var needsmetadata = true;
|
|
2983
2832
|
//Attach resize event
|
|
2984
|
-
|
|
2985
2833
|
object.onresize = function () {
|
|
2986
2834
|
//Create event
|
|
2987
|
-
var event = document.createEvent(
|
|
2835
|
+
var event = document.createEvent("Event");
|
|
2988
2836
|
//Init metadata or resize event
|
|
2989
|
-
|
|
2990
|
-
event.initEvent(needsmetadata ? 'loadedmetadata' : 'resize', false, false);
|
|
2837
|
+
event.initEvent(needsmetadata ? "loadedmetadata" : "resize", false, false);
|
|
2991
2838
|
//Dispatch it
|
|
2992
2839
|
video.dispatchEvent(event);
|
|
2993
2840
|
//No more medatada event
|
|
@@ -2996,12 +2843,9 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
2996
2843
|
//Get stream track video stream
|
|
2997
2844
|
var videoTracks = stream.getVideoTracks();
|
|
2998
2845
|
//If found any
|
|
2999
|
-
|
|
3000
2846
|
if (videoTracks.length)
|
|
3001
2847
|
//Set native video track on video renderer object
|
|
3002
|
-
|
|
3003
|
-
object.setTrack(videoTracks[0].priv.track);
|
|
3004
|
-
}
|
|
2848
|
+
object.setTrack(videoTracks[0].priv.track);
|
|
3005
2849
|
//Store it
|
|
3006
2850
|
srcObject = stream;
|
|
3007
2851
|
//Show renderer
|
|
@@ -3039,9 +2883,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3039
2883
|
};
|
|
3040
2884
|
|
|
3041
2885
|
VideoRenderer.handle = function (video) {
|
|
3042
|
-
if (!video.videoRenderer)
|
|
3043
|
-
video.videoRenderer = new VideoRenderer(video);
|
|
3044
|
-
}
|
|
2886
|
+
if (!video.videoRenderer) video.videoRenderer = new VideoRenderer(video);
|
|
3045
2887
|
};
|
|
3046
2888
|
|
|
3047
2889
|
VideoRenderer.unhandle = function (video) {
|
|
@@ -3055,9 +2897,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3055
2897
|
//Check object is not shown
|
|
3056
2898
|
if (this.video !== this.object.parentElement)
|
|
3057
2899
|
//Nothing
|
|
3058
|
-
|
|
3059
|
-
return;
|
|
3060
|
-
}
|
|
2900
|
+
return;
|
|
3061
2901
|
//Swap them
|
|
3062
2902
|
this.video.parentNode.replaceChild(this.object, this.video);
|
|
3063
2903
|
this.object.appendChild(this.video);
|
|
@@ -3067,9 +2907,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3067
2907
|
//Check object is not shown
|
|
3068
2908
|
if (this.object !== this.video.parentElement)
|
|
3069
2909
|
//Nothing
|
|
3070
|
-
|
|
3071
|
-
return;
|
|
3072
|
-
}
|
|
2910
|
+
return;
|
|
3073
2911
|
//Swap them
|
|
3074
2912
|
this.object.parentNode.replaceChild(this.video, this.object);
|
|
3075
2913
|
this.video.appendChild(this.object);
|
|
@@ -3094,45 +2932,57 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3094
2932
|
}
|
|
3095
2933
|
|
|
3096
2934
|
module.exports = WebRTCProxy;
|
|
3097
|
-
}, {
|
|
2935
|
+
}, { "detect-browser": 18 }], 18: [function (require, module, exports) {
|
|
3098
2936
|
(function (process) {
|
|
3099
|
-
|
|
3100
2937
|
/**
|
|
3101
|
-
|
|
2938
|
+
# detect-browser
|
|
2939
|
+
|
|
3102
2940
|
This is a package that attempts to detect a browser vendor and version (in
|
|
3103
|
-
|
|
3104
|
-
|
|
2941
|
+
a semver compatible format) using a navigator useragent in a browser or
|
|
2942
|
+
`process.version` in node.
|
|
2943
|
+
|
|
3105
2944
|
## NOTE: Version 2.x release
|
|
2945
|
+
|
|
3106
2946
|
Release 2.0 introduces a breaking API change (hence the major release)
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
2947
|
+
which requires invocation of a `detect` function rather than just inclusion of
|
|
2948
|
+
the module. PR [#46](https://github.com/DamonOehlman/detect-browser/pull/46)
|
|
2949
|
+
provides more context as to why this change has been made.
|
|
2950
|
+
|
|
3110
2951
|
## Example Usage
|
|
2952
|
+
|
|
3111
2953
|
<<< examples/simple.js
|
|
2954
|
+
|
|
3112
2955
|
Or you can use a switch statement:
|
|
2956
|
+
|
|
3113
2957
|
<<< examples/switch.js
|
|
2958
|
+
|
|
3114
2959
|
## Adding additional browser support
|
|
2960
|
+
|
|
3115
2961
|
The current list of browsers that can be detected by `detect-browser` is
|
|
3116
|
-
|
|
3117
|
-
|
|
2962
|
+
not exhaustive. If you have a browser that you would like to add support for
|
|
2963
|
+
then please submit a pull request with the implementation.
|
|
2964
|
+
|
|
3118
2965
|
Creating an acceptable implementation requires two things:
|
|
2966
|
+
|
|
3119
2967
|
1. A test demonstrating that the regular expression you have defined identifies
|
|
3120
|
-
|
|
3121
|
-
|
|
2968
|
+
your new browser correctly. Examples of this can be found in the
|
|
2969
|
+
`test/logic.js` file.
|
|
2970
|
+
|
|
3122
2971
|
2. Write the actual regex to the `lib/detectBrowser.js` file. In most cases adding
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
2972
|
+
the regex to the list of existing regexes will be suitable (if usage of `detect-brower`
|
|
2973
|
+
returns `undefined` for instance), but in some cases you might have to add it before
|
|
2974
|
+
an existing regex. This would be true for a case where you have a browser that
|
|
2975
|
+
is a specialised variant of an existing browser but is identified as the
|
|
2976
|
+
non-specialised case.
|
|
2977
|
+
|
|
3128
2978
|
When writing the regular expression remember that you would write it containing a
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
2979
|
+
single [capturing group](https://regexone.com/lesson/capturing_groups) which
|
|
2980
|
+
captures the version number of the browser.
|
|
2981
|
+
|
|
2982
|
+
**/
|
|
3132
2983
|
|
|
3133
2984
|
function detect() {
|
|
3134
2985
|
var nodeVersion = getNodeVersion();
|
|
3135
|
-
|
|
3136
2986
|
if (nodeVersion) {
|
|
3137
2987
|
return nodeVersion;
|
|
3138
2988
|
} else if (typeof navigator !== 'undefined') {
|
|
@@ -3153,7 +3003,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3153
3003
|
|
|
3154
3004
|
function getNodeVersion() {
|
|
3155
3005
|
var isNode = typeof navigator === 'undefined' && typeof process !== 'undefined';
|
|
3156
|
-
|
|
3157
3006
|
return isNode ? {
|
|
3158
3007
|
name: 'node',
|
|
3159
3008
|
version: process.version.slice(1),
|
|
@@ -3163,7 +3012,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3163
3012
|
|
|
3164
3013
|
function parseUserAgent(userAgentString) {
|
|
3165
3014
|
var browsers = getBrowserRules();
|
|
3166
|
-
|
|
3167
3015
|
if (!userAgentString) {
|
|
3168
3016
|
return null;
|
|
3169
3017
|
}
|
|
@@ -3213,6 +3061,6 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
|
3213
3061
|
parseUserAgent: parseUserAgent
|
|
3214
3062
|
};
|
|
3215
3063
|
}).call(this, require('_process'));
|
|
3216
|
-
}, {
|
|
3064
|
+
}, { "_process": 2, "os": 1 }] }, {}, [3])(3);
|
|
3217
3065
|
});
|
|
3218
3066
|
//# sourceMappingURL=webrtc-ie-shim.js.map
|