@volcengine/veplayer-plugin 2.7.1-rc.1 → 2.7.1-rc.2
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/esm/index.development.js +1046 -348
- package/esm/index.production.js +4 -4
- package/esm/veplayer.plugin.rtm.development.js +903 -205
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.rtm.development.js +877 -179
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -41,10 +41,10 @@ function _regeneratorRuntime$1() {
|
|
|
41
41
|
return obj[key] = value;
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function wrap(innerFn, outerFn,
|
|
44
|
+
function wrap(innerFn, outerFn, self2, tryLocsList) {
|
|
45
45
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
|
|
46
46
|
return defineProperty(generator, "_invoke", {
|
|
47
|
-
value: makeInvokeMethod(innerFn,
|
|
47
|
+
value: makeInvokeMethod(innerFn, self2, context)
|
|
48
48
|
}), generator;
|
|
49
49
|
}
|
|
50
50
|
function tryCatch(fn, obj, arg) {
|
|
@@ -111,7 +111,7 @@ function _regeneratorRuntime$1() {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
function makeInvokeMethod(innerFn,
|
|
114
|
+
function makeInvokeMethod(innerFn, self2, context) {
|
|
115
115
|
var state = "suspendedStart";
|
|
116
116
|
return function(method, arg) {
|
|
117
117
|
if ("executing" === state)
|
|
@@ -140,7 +140,7 @@ function _regeneratorRuntime$1() {
|
|
|
140
140
|
} else
|
|
141
141
|
"return" === context.method && context.abrupt("return", context.arg);
|
|
142
142
|
state = "executing";
|
|
143
|
-
var record = tryCatch(innerFn,
|
|
143
|
+
var record = tryCatch(innerFn, self2, context);
|
|
144
144
|
if ("normal" === record.type) {
|
|
145
145
|
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
|
|
146
146
|
continue;
|
|
@@ -222,9 +222,9 @@ function _regeneratorRuntime$1() {
|
|
|
222
222
|
};
|
|
223
223
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
|
224
224
|
return this;
|
|
225
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn,
|
|
225
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
|
|
226
226
|
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
227
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn,
|
|
227
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
|
|
228
228
|
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
229
229
|
return result.done ? result.value : iter.next();
|
|
230
230
|
});
|
|
@@ -351,9 +351,9 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
351
351
|
}
|
|
352
352
|
function _asyncToGenerator$1(fn) {
|
|
353
353
|
return function() {
|
|
354
|
-
var
|
|
354
|
+
var self2 = this, args = arguments;
|
|
355
355
|
return new Promise(function(resolve, reject) {
|
|
356
|
-
var gen = fn.apply(
|
|
356
|
+
var gen = fn.apply(self2, args);
|
|
357
357
|
function _next(value) {
|
|
358
358
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
359
359
|
}
|
|
@@ -364,33 +364,33 @@ function _asyncToGenerator$1(fn) {
|
|
|
364
364
|
});
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
function _classCallCheck$
|
|
367
|
+
function _classCallCheck$3(instance, Constructor) {
|
|
368
368
|
if (!(instance instanceof Constructor)) {
|
|
369
369
|
throw new TypeError("Cannot call a class as a function");
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
function _defineProperties$
|
|
372
|
+
function _defineProperties$3(target, props) {
|
|
373
373
|
for (var i = 0; i < props.length; i++) {
|
|
374
374
|
var descriptor = props[i];
|
|
375
375
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
376
376
|
descriptor.configurable = true;
|
|
377
377
|
if ("value" in descriptor)
|
|
378
378
|
descriptor.writable = true;
|
|
379
|
-
Object.defineProperty(target, _toPropertyKey$
|
|
379
|
+
Object.defineProperty(target, _toPropertyKey$3(descriptor.key), descriptor);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
function _createClass$
|
|
382
|
+
function _createClass$3(Constructor, protoProps, staticProps) {
|
|
383
383
|
if (protoProps)
|
|
384
|
-
_defineProperties$
|
|
384
|
+
_defineProperties$3(Constructor.prototype, protoProps);
|
|
385
385
|
if (staticProps)
|
|
386
|
-
_defineProperties$
|
|
386
|
+
_defineProperties$3(Constructor, staticProps);
|
|
387
387
|
Object.defineProperty(Constructor, "prototype", {
|
|
388
388
|
writable: false
|
|
389
389
|
});
|
|
390
390
|
return Constructor;
|
|
391
391
|
}
|
|
392
392
|
function _defineProperty$2(obj, key, value) {
|
|
393
|
-
key = _toPropertyKey$
|
|
393
|
+
key = _toPropertyKey$3(key);
|
|
394
394
|
if (key in obj) {
|
|
395
395
|
Object.defineProperty(obj, key, {
|
|
396
396
|
value,
|
|
@@ -448,19 +448,19 @@ function _isNativeReflectConstruct$1() {
|
|
|
448
448
|
return false;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
function _assertThisInitialized$1(
|
|
452
|
-
if (
|
|
451
|
+
function _assertThisInitialized$1(self2) {
|
|
452
|
+
if (self2 === void 0) {
|
|
453
453
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
454
454
|
}
|
|
455
|
-
return
|
|
455
|
+
return self2;
|
|
456
456
|
}
|
|
457
|
-
function _possibleConstructorReturn$1(
|
|
457
|
+
function _possibleConstructorReturn$1(self2, call) {
|
|
458
458
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
459
459
|
return call;
|
|
460
460
|
} else if (call !== void 0) {
|
|
461
461
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
462
462
|
}
|
|
463
|
-
return _assertThisInitialized$1(
|
|
463
|
+
return _assertThisInitialized$1(self2);
|
|
464
464
|
}
|
|
465
465
|
function _createSuper$1(Derived) {
|
|
466
466
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
@@ -475,7 +475,7 @@ function _createSuper$1(Derived) {
|
|
|
475
475
|
return _possibleConstructorReturn$1(this, result);
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
function _toPrimitive$
|
|
478
|
+
function _toPrimitive$3(input, hint) {
|
|
479
479
|
if (typeof input !== "object" || input === null)
|
|
480
480
|
return input;
|
|
481
481
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -487,8 +487,8 @@ function _toPrimitive$2(input, hint) {
|
|
|
487
487
|
}
|
|
488
488
|
return (hint === "string" ? String : Number)(input);
|
|
489
489
|
}
|
|
490
|
-
function _toPropertyKey$
|
|
491
|
-
var key = _toPrimitive$
|
|
490
|
+
function _toPropertyKey$3(arg) {
|
|
491
|
+
var key = _toPrimitive$3(arg, "string");
|
|
492
492
|
return typeof key === "symbol" ? key : String(key);
|
|
493
493
|
}
|
|
494
494
|
function ownKeys$1(object, enumerableOnly) {
|
|
@@ -520,33 +520,33 @@ function _typeof$1(obj) {
|
|
|
520
520
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
521
521
|
}, _typeof$1(obj);
|
|
522
522
|
}
|
|
523
|
-
function _classCallCheck$
|
|
523
|
+
function _classCallCheck$2(instance, Constructor) {
|
|
524
524
|
if (!(instance instanceof Constructor)) {
|
|
525
525
|
throw new TypeError("Cannot call a class as a function");
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
function _defineProperties$
|
|
528
|
+
function _defineProperties$2(target, props) {
|
|
529
529
|
for (var i = 0; i < props.length; i++) {
|
|
530
530
|
var descriptor = props[i];
|
|
531
531
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
532
532
|
descriptor.configurable = true;
|
|
533
533
|
if ("value" in descriptor)
|
|
534
534
|
descriptor.writable = true;
|
|
535
|
-
Object.defineProperty(target, _toPropertyKey$
|
|
535
|
+
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
function _createClass$
|
|
538
|
+
function _createClass$2(Constructor, protoProps, staticProps) {
|
|
539
539
|
if (protoProps)
|
|
540
|
-
_defineProperties$
|
|
540
|
+
_defineProperties$2(Constructor.prototype, protoProps);
|
|
541
541
|
if (staticProps)
|
|
542
|
-
_defineProperties$
|
|
542
|
+
_defineProperties$2(Constructor, staticProps);
|
|
543
543
|
Object.defineProperty(Constructor, "prototype", {
|
|
544
544
|
writable: false
|
|
545
545
|
});
|
|
546
546
|
return Constructor;
|
|
547
547
|
}
|
|
548
548
|
function _defineProperty$1(obj, key, value) {
|
|
549
|
-
key = _toPropertyKey$
|
|
549
|
+
key = _toPropertyKey$2(key);
|
|
550
550
|
if (key in obj) {
|
|
551
551
|
Object.defineProperty(obj, key, {
|
|
552
552
|
value,
|
|
@@ -593,7 +593,7 @@ function _arrayLikeToArray$1(arr, len) {
|
|
|
593
593
|
function _nonIterableSpread() {
|
|
594
594
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
595
595
|
}
|
|
596
|
-
function _toPrimitive$
|
|
596
|
+
function _toPrimitive$2(input, hint) {
|
|
597
597
|
if (typeof input !== "object" || input === null)
|
|
598
598
|
return input;
|
|
599
599
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -605,8 +605,8 @@ function _toPrimitive$1(input, hint) {
|
|
|
605
605
|
}
|
|
606
606
|
return (hint === "string" ? String : Number)(input);
|
|
607
607
|
}
|
|
608
|
-
function _toPropertyKey$
|
|
609
|
-
var key = _toPrimitive$
|
|
608
|
+
function _toPropertyKey$2(arg) {
|
|
609
|
+
var key = _toPrimitive$2(arg, "string");
|
|
610
610
|
return typeof key === "symbol" ? key : String(key);
|
|
611
611
|
}
|
|
612
612
|
function getDefaultExportFromCjs(x) {
|
|
@@ -830,10 +830,10 @@ var XG_DEBUG = {
|
|
|
830
830
|
};
|
|
831
831
|
var XgplayerTimeRange = /* @__PURE__ */ function() {
|
|
832
832
|
function XgplayerTimeRange2(bufferedList) {
|
|
833
|
-
_classCallCheck$
|
|
833
|
+
_classCallCheck$2(this, XgplayerTimeRange2);
|
|
834
834
|
this.bufferedList = bufferedList;
|
|
835
835
|
}
|
|
836
|
-
_createClass$
|
|
836
|
+
_createClass$2(XgplayerTimeRange2, [{
|
|
837
837
|
key: "start",
|
|
838
838
|
value: function start(index) {
|
|
839
839
|
return this.bufferedList[index].start;
|
|
@@ -1539,7 +1539,7 @@ var ERROR_MAP = {
|
|
|
1539
1539
|
5: 5105,
|
|
1540
1540
|
6: 5106
|
|
1541
1541
|
};
|
|
1542
|
-
var Errors = /* @__PURE__ */ _createClass$
|
|
1542
|
+
var Errors = /* @__PURE__ */ _createClass$2(
|
|
1543
1543
|
function Errors2(player) {
|
|
1544
1544
|
var errorInfo = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
1545
1545
|
errorType: "",
|
|
@@ -1549,7 +1549,7 @@ var Errors = /* @__PURE__ */ _createClass$1(
|
|
|
1549
1549
|
ext: {},
|
|
1550
1550
|
mediaError: null
|
|
1551
1551
|
};
|
|
1552
|
-
_classCallCheck$
|
|
1552
|
+
_classCallCheck$2(this, Errors2);
|
|
1553
1553
|
var ERROR_TYPES = player && player.i18n ? player.i18n.ERROR_TYPES : null;
|
|
1554
1554
|
if (player.media) {
|
|
1555
1555
|
var mediaError = errorInfo.mediaError ? errorInfo.mediaError : player.media.error || {};
|
|
@@ -1766,7 +1766,7 @@ function showErrorMsg(pluginName, msg) {
|
|
|
1766
1766
|
}
|
|
1767
1767
|
var BasePlugin = /* @__PURE__ */ function() {
|
|
1768
1768
|
function BasePlugin2(args) {
|
|
1769
|
-
_classCallCheck$
|
|
1769
|
+
_classCallCheck$2(this, BasePlugin2);
|
|
1770
1770
|
if (util.checkIsFunction(this.beforeCreate)) {
|
|
1771
1771
|
this.beforeCreate(args);
|
|
1772
1772
|
}
|
|
@@ -1780,7 +1780,7 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
1780
1780
|
this.pluginName = "";
|
|
1781
1781
|
this.__init(args);
|
|
1782
1782
|
}
|
|
1783
|
-
_createClass$
|
|
1783
|
+
_createClass$2(BasePlugin2, [{
|
|
1784
1784
|
key: "beforeCreate",
|
|
1785
1785
|
value: function beforeCreate(args) {
|
|
1786
1786
|
}
|
|
@@ -2068,10 +2068,10 @@ function _regeneratorRuntime() {
|
|
|
2068
2068
|
return obj[key] = value;
|
|
2069
2069
|
};
|
|
2070
2070
|
}
|
|
2071
|
-
function wrap(innerFn, outerFn,
|
|
2071
|
+
function wrap(innerFn, outerFn, self2, tryLocsList) {
|
|
2072
2072
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
|
|
2073
2073
|
return defineProperty(generator, "_invoke", {
|
|
2074
|
-
value: makeInvokeMethod(innerFn,
|
|
2074
|
+
value: makeInvokeMethod(innerFn, self2, context)
|
|
2075
2075
|
}), generator;
|
|
2076
2076
|
}
|
|
2077
2077
|
function tryCatch(fn, obj, arg) {
|
|
@@ -2138,7 +2138,7 @@ function _regeneratorRuntime() {
|
|
|
2138
2138
|
}
|
|
2139
2139
|
});
|
|
2140
2140
|
}
|
|
2141
|
-
function makeInvokeMethod(innerFn,
|
|
2141
|
+
function makeInvokeMethod(innerFn, self2, context) {
|
|
2142
2142
|
var state = "suspendedStart";
|
|
2143
2143
|
return function(method, arg) {
|
|
2144
2144
|
if ("executing" === state)
|
|
@@ -2167,7 +2167,7 @@ function _regeneratorRuntime() {
|
|
|
2167
2167
|
} else
|
|
2168
2168
|
"return" === context.method && context.abrupt("return", context.arg);
|
|
2169
2169
|
state = "executing";
|
|
2170
|
-
var record = tryCatch(innerFn,
|
|
2170
|
+
var record = tryCatch(innerFn, self2, context);
|
|
2171
2171
|
if ("normal" === record.type) {
|
|
2172
2172
|
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
|
|
2173
2173
|
continue;
|
|
@@ -2249,9 +2249,9 @@ function _regeneratorRuntime() {
|
|
|
2249
2249
|
};
|
|
2250
2250
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
|
2251
2251
|
return this;
|
|
2252
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn,
|
|
2252
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
|
|
2253
2253
|
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2254
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn,
|
|
2254
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
|
|
2255
2255
|
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
2256
2256
|
return result.done ? result.value : iter.next();
|
|
2257
2257
|
});
|
|
@@ -2386,9 +2386,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2386
2386
|
}
|
|
2387
2387
|
function _asyncToGenerator(fn) {
|
|
2388
2388
|
return function() {
|
|
2389
|
-
var
|
|
2389
|
+
var self2 = this, args = arguments;
|
|
2390
2390
|
return new Promise(function(resolve, reject) {
|
|
2391
|
-
var gen = fn.apply(
|
|
2391
|
+
var gen = fn.apply(self2, args);
|
|
2392
2392
|
function _next(value) {
|
|
2393
2393
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2394
2394
|
}
|
|
@@ -2399,33 +2399,33 @@ function _asyncToGenerator(fn) {
|
|
|
2399
2399
|
});
|
|
2400
2400
|
};
|
|
2401
2401
|
}
|
|
2402
|
-
function _classCallCheck(instance, Constructor) {
|
|
2402
|
+
function _classCallCheck$1(instance, Constructor) {
|
|
2403
2403
|
if (!(instance instanceof Constructor)) {
|
|
2404
2404
|
throw new TypeError("Cannot call a class as a function");
|
|
2405
2405
|
}
|
|
2406
2406
|
}
|
|
2407
|
-
function _defineProperties(target, props) {
|
|
2407
|
+
function _defineProperties$1(target, props) {
|
|
2408
2408
|
for (var i = 0; i < props.length; i++) {
|
|
2409
2409
|
var descriptor = props[i];
|
|
2410
2410
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
2411
2411
|
descriptor.configurable = true;
|
|
2412
2412
|
if ("value" in descriptor)
|
|
2413
2413
|
descriptor.writable = true;
|
|
2414
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
2414
|
+
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
2417
|
+
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
2418
2418
|
if (protoProps)
|
|
2419
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
2419
|
+
_defineProperties$1(Constructor.prototype, protoProps);
|
|
2420
2420
|
if (staticProps)
|
|
2421
|
-
_defineProperties(Constructor, staticProps);
|
|
2421
|
+
_defineProperties$1(Constructor, staticProps);
|
|
2422
2422
|
Object.defineProperty(Constructor, "prototype", {
|
|
2423
2423
|
writable: false
|
|
2424
2424
|
});
|
|
2425
2425
|
return Constructor;
|
|
2426
2426
|
}
|
|
2427
2427
|
function _defineProperty(obj, key, value) {
|
|
2428
|
-
key = _toPropertyKey(key);
|
|
2428
|
+
key = _toPropertyKey$1(key);
|
|
2429
2429
|
if (key in obj) {
|
|
2430
2430
|
Object.defineProperty(obj, key, {
|
|
2431
2431
|
value,
|
|
@@ -2562,19 +2562,19 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
2562
2562
|
}
|
|
2563
2563
|
return target;
|
|
2564
2564
|
}
|
|
2565
|
-
function _assertThisInitialized(
|
|
2566
|
-
if (
|
|
2565
|
+
function _assertThisInitialized(self2) {
|
|
2566
|
+
if (self2 === void 0) {
|
|
2567
2567
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2568
2568
|
}
|
|
2569
|
-
return
|
|
2569
|
+
return self2;
|
|
2570
2570
|
}
|
|
2571
|
-
function _possibleConstructorReturn(
|
|
2571
|
+
function _possibleConstructorReturn(self2, call) {
|
|
2572
2572
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
2573
2573
|
return call;
|
|
2574
2574
|
} else if (call !== void 0) {
|
|
2575
2575
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
2576
2576
|
}
|
|
2577
|
-
return _assertThisInitialized(
|
|
2577
|
+
return _assertThisInitialized(self2);
|
|
2578
2578
|
}
|
|
2579
2579
|
function _createSuper(Derived) {
|
|
2580
2580
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
@@ -2688,7 +2688,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
};
|
|
2690
2690
|
}
|
|
2691
|
-
function _toPrimitive(input, hint) {
|
|
2691
|
+
function _toPrimitive$1(input, hint) {
|
|
2692
2692
|
if (typeof input !== "object" || input === null)
|
|
2693
2693
|
return input;
|
|
2694
2694
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -2700,8 +2700,8 @@ function _toPrimitive(input, hint) {
|
|
|
2700
2700
|
}
|
|
2701
2701
|
return (hint === "string" ? String : Number)(input);
|
|
2702
2702
|
}
|
|
2703
|
-
function _toPropertyKey(arg) {
|
|
2704
|
-
var key = _toPrimitive(arg, "string");
|
|
2703
|
+
function _toPropertyKey$1(arg) {
|
|
2704
|
+
var key = _toPrimitive$1(arg, "string");
|
|
2705
2705
|
return typeof key === "symbol" ? key : String(key);
|
|
2706
2706
|
}
|
|
2707
2707
|
function createPublicPromise() {
|
|
@@ -2800,7 +2800,7 @@ var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
|
2800
2800
|
var _super = _createSuper(StreamingError2);
|
|
2801
2801
|
function StreamingError2(type, subType, origin, payload, msg) {
|
|
2802
2802
|
var _this;
|
|
2803
|
-
_classCallCheck(this, StreamingError2);
|
|
2803
|
+
_classCallCheck$1(this, StreamingError2);
|
|
2804
2804
|
_this = _super.call(this, msg || (origin === null || origin === void 0 ? void 0 : origin.message));
|
|
2805
2805
|
_this.errorType = type === ERR.NETWORK_TIMEOUT ? ERR.NETWORK : type;
|
|
2806
2806
|
_this.originError = origin;
|
|
@@ -2813,7 +2813,7 @@ var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
return _this;
|
|
2815
2815
|
}
|
|
2816
|
-
_createClass(StreamingError2, null, [{
|
|
2816
|
+
_createClass$1(StreamingError2, null, [{
|
|
2817
2817
|
key: "create",
|
|
2818
2818
|
value: function create(type, subType, origin, payload, msg) {
|
|
2819
2819
|
if (type instanceof StreamingError2) {
|
|
@@ -2849,7 +2849,7 @@ var LOG_MAX_SIZE = 200 * 1024;
|
|
|
2849
2849
|
var SIMPLE_TYPE = ["Boolean", "Number", "String", "Undefined", "Null", "Date", "Object"];
|
|
2850
2850
|
var Logger = /* @__PURE__ */ function() {
|
|
2851
2851
|
function Logger2(name, config) {
|
|
2852
|
-
_classCallCheck(this, Logger2);
|
|
2852
|
+
_classCallCheck$1(this, Logger2);
|
|
2853
2853
|
this.name = name || "";
|
|
2854
2854
|
this._prefix = "[".concat(this.name, "]");
|
|
2855
2855
|
this.logCacheLevel = (config === null || config === void 0 ? void 0 : config.logCacheLevel) || 3;
|
|
@@ -2857,7 +2857,7 @@ var Logger = /* @__PURE__ */ function() {
|
|
|
2857
2857
|
this.logSize = 0;
|
|
2858
2858
|
this.logTextArray = [];
|
|
2859
2859
|
}
|
|
2860
|
-
_createClass(Logger2, [{
|
|
2860
|
+
_createClass$1(Logger2, [{
|
|
2861
2861
|
key: "debug",
|
|
2862
2862
|
value: function debug() {
|
|
2863
2863
|
var _console;
|
|
@@ -3035,7 +3035,7 @@ var NetError = /* @__PURE__ */ function(_Error) {
|
|
|
3035
3035
|
var _super = _createSuper(NetError2);
|
|
3036
3036
|
function NetError2(url, request, response, msg) {
|
|
3037
3037
|
var _this;
|
|
3038
|
-
_classCallCheck(this, NetError2);
|
|
3038
|
+
_classCallCheck$1(this, NetError2);
|
|
3039
3039
|
_this = _super.call(this, msg);
|
|
3040
3040
|
_defineProperty(_assertThisInitialized(_this), "retryCount", 0);
|
|
3041
3041
|
_defineProperty(_assertThisInitialized(_this), "isTimeout", false);
|
|
@@ -3048,7 +3048,7 @@ var NetError = /* @__PURE__ */ function(_Error) {
|
|
|
3048
3048
|
_this.response = response;
|
|
3049
3049
|
return _this;
|
|
3050
3050
|
}
|
|
3051
|
-
return _createClass(NetError2);
|
|
3051
|
+
return _createClass$1(NetError2);
|
|
3052
3052
|
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
3053
3053
|
var toString = Object.prototype.toString;
|
|
3054
3054
|
function isObject(a) {
|
|
@@ -3173,7 +3173,7 @@ var FetchLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
3173
3173
|
var _super = _createSuper(FetchLoader2);
|
|
3174
3174
|
function FetchLoader2() {
|
|
3175
3175
|
var _this;
|
|
3176
|
-
_classCallCheck(this, FetchLoader2);
|
|
3176
|
+
_classCallCheck$1(this, FetchLoader2);
|
|
3177
3177
|
_this = _super.call(this);
|
|
3178
3178
|
_defineProperty(_assertThisInitialized(_this), "_abortController", null);
|
|
3179
3179
|
_defineProperty(_assertThisInitialized(_this), "_timeoutTimer", null);
|
|
@@ -3191,7 +3191,7 @@ var FetchLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
3191
3191
|
_defineProperty(_assertThisInitialized(_this), "_priOptions", null);
|
|
3192
3192
|
return _this;
|
|
3193
3193
|
}
|
|
3194
|
-
_createClass(FetchLoader2, [{
|
|
3194
|
+
_createClass$1(FetchLoader2, [{
|
|
3195
3195
|
key: "load",
|
|
3196
3196
|
value: function load(_ref) {
|
|
3197
3197
|
var _this$_abortControlle, _this2 = this;
|
|
@@ -3625,7 +3625,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
3625
3625
|
var _super = _createSuper(XhrLoader2);
|
|
3626
3626
|
function XhrLoader2() {
|
|
3627
3627
|
var _this;
|
|
3628
|
-
_classCallCheck(this, XhrLoader2);
|
|
3628
|
+
_classCallCheck$1(this, XhrLoader2);
|
|
3629
3629
|
_this = _super.call(this);
|
|
3630
3630
|
_defineProperty(_assertThisInitialized(_this), "_xhr", null);
|
|
3631
3631
|
_defineProperty(_assertThisInitialized(_this), "_aborted", false);
|
|
@@ -3655,7 +3655,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
3655
3655
|
_defineProperty(_assertThisInitialized(_this), "_priOptions", null);
|
|
3656
3656
|
return _this;
|
|
3657
3657
|
}
|
|
3658
|
-
_createClass(XhrLoader2, [{
|
|
3658
|
+
_createClass$1(XhrLoader2, [{
|
|
3659
3659
|
key: "load",
|
|
3660
3660
|
value: function load(req) {
|
|
3661
3661
|
var _this2 = this;
|
|
@@ -3940,7 +3940,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
3940
3940
|
var _excluded = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
3941
3941
|
var Task = /* @__PURE__ */ function() {
|
|
3942
3942
|
function Task2(type, config) {
|
|
3943
|
-
_classCallCheck(this, Task2);
|
|
3943
|
+
_classCallCheck$1(this, Task2);
|
|
3944
3944
|
this.promise = createPublicPromise();
|
|
3945
3945
|
this.alive = !!config.onProgress;
|
|
3946
3946
|
!config.logger && (config.logger = new Logger("Loader"));
|
|
@@ -3953,7 +3953,7 @@ var Task = /* @__PURE__ */ function() {
|
|
|
3953
3953
|
this._retryCheckFunc = config.retryCheckFunc;
|
|
3954
3954
|
this._logger = config.logger;
|
|
3955
3955
|
}
|
|
3956
|
-
_createClass(Task2, [{
|
|
3956
|
+
_createClass$1(Task2, [{
|
|
3957
3957
|
key: "exec",
|
|
3958
3958
|
value: function exec() {
|
|
3959
3959
|
var _this = this;
|
|
@@ -4072,7 +4072,7 @@ var NetLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4072
4072
|
var _super = _createSuper(NetLoader2);
|
|
4073
4073
|
function NetLoader2(cfg) {
|
|
4074
4074
|
var _this;
|
|
4075
|
-
_classCallCheck(this, NetLoader2);
|
|
4075
|
+
_classCallCheck$1(this, NetLoader2);
|
|
4076
4076
|
_this = _super.call(this, cfg);
|
|
4077
4077
|
_defineProperty(_assertThisInitialized(_this), "type", LoaderType.FETCH);
|
|
4078
4078
|
_defineProperty(_assertThisInitialized(_this), "_queue", []);
|
|
@@ -4087,7 +4087,7 @@ var NetLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4087
4087
|
_this.log = cfg.logger;
|
|
4088
4088
|
return _this;
|
|
4089
4089
|
}
|
|
4090
|
-
_createClass(NetLoader2, [{
|
|
4090
|
+
_createClass$1(NetLoader2, [{
|
|
4091
4091
|
key: "isFetch",
|
|
4092
4092
|
value: function isFetch() {
|
|
4093
4093
|
return this.type === LoaderType.FETCH;
|
|
@@ -4881,7 +4881,9 @@ function getOption(opts) {
|
|
|
4881
4881
|
networkEvaluateInterval: 1e3,
|
|
4882
4882
|
delayHint: 0,
|
|
4883
4883
|
seamlesslyReload: false,
|
|
4884
|
-
|
|
4884
|
+
enableSei: false,
|
|
4885
|
+
enableOriginSdpLogger: false,
|
|
4886
|
+
checkStatsErrorDelay: 5e3
|
|
4885
4887
|
}, opts);
|
|
4886
4888
|
}
|
|
4887
4889
|
function _getStats(stats) {
|
|
@@ -4896,10 +4898,11 @@ function _getStats(stats) {
|
|
|
4896
4898
|
}
|
|
4897
4899
|
});
|
|
4898
4900
|
return inboundRtps.map(function(inbound) {
|
|
4901
|
+
var _inbound$mediaType;
|
|
4899
4902
|
var codec = stats.get(inbound.codecId);
|
|
4900
4903
|
var track = stats.get(inbound.trackId);
|
|
4901
4904
|
return {
|
|
4902
|
-
type: inbound.mediaType,
|
|
4905
|
+
type: (_inbound$mediaType = inbound.mediaType) !== null && _inbound$mediaType !== void 0 ? _inbound$mediaType : inbound.kind,
|
|
4903
4906
|
inboundRtp: inbound,
|
|
4904
4907
|
remoteOutBoundRtp: remoteOutboundRtps.find(function(x) {
|
|
4905
4908
|
return x.mediaType === inbound.mediaType;
|
|
@@ -4919,7 +4922,7 @@ function getStats(pc) {
|
|
|
4919
4922
|
});
|
|
4920
4923
|
}
|
|
4921
4924
|
function getStatsSnapshoot(stats) {
|
|
4922
|
-
var _v$
|
|
4925
|
+
var _v$inboundRtp, _v$codec, _v$codec2, _v$codec3, _v$inboundRtp4, _v$inboundRtp5, _v$inboundRtp6, _v$inboundRtp7, _v$inboundRtp8, _v$inboundRtp9, _v$inboundRtp10, _v$inboundRtp11, _v$inboundRtp$framesR, _v$inboundRtp12, _v$track, _v$inboundRtp13, _v$inboundRtp14, _v$inboundRtp15, _v$inboundRtp16, _v$inboundRtp17, _v$inboundRtp18, _a$codec, _a$codec2, _a$codec3, _a$inboundRtp, _a$inboundRtp2, _a$inboundRtp3, _a$inboundRtp4, _a$inboundRtp5, _a$inboundRtp6, _a$inboundRtp7, _a$inboundRtp8;
|
|
4923
4926
|
var v = stats === null || stats === void 0 ? void 0 : stats.filter(function(x) {
|
|
4924
4927
|
return x.type === "video";
|
|
4925
4928
|
})[0];
|
|
@@ -4928,6 +4931,7 @@ function getStatsSnapshoot(stats) {
|
|
|
4928
4931
|
})[0];
|
|
4929
4932
|
var videoRemote;
|
|
4930
4933
|
var audioRemote;
|
|
4934
|
+
var averageJitterBufferDelay;
|
|
4931
4935
|
if (v && v.remoteOutBoundRtp) {
|
|
4932
4936
|
videoRemote = {
|
|
4933
4937
|
bytesSent: v.remoteOutBoundRtp.bytesSent,
|
|
@@ -4940,26 +4944,31 @@ function getStatsSnapshoot(stats) {
|
|
|
4940
4944
|
packetsSent: a.remoteOutBoundRtp.packetsSent
|
|
4941
4945
|
};
|
|
4942
4946
|
}
|
|
4947
|
+
if ((v === null || v === void 0 ? void 0 : (_v$inboundRtp = v.inboundRtp) === null || _v$inboundRtp === void 0 ? void 0 : _v$inboundRtp.jitterBufferDelay) !== void 0) {
|
|
4948
|
+
var _v$inboundRtp2, _v$inboundRtp3;
|
|
4949
|
+
averageJitterBufferDelay = ((_v$inboundRtp2 = v.inboundRtp) === null || _v$inboundRtp2 === void 0 ? void 0 : _v$inboundRtp2.jitterBufferDelay) / ((_v$inboundRtp3 = v.inboundRtp) === null || _v$inboundRtp3 === void 0 ? void 0 : _v$inboundRtp3.jitterBufferEmittedCount) * 1e3;
|
|
4950
|
+
}
|
|
4943
4951
|
return {
|
|
4944
4952
|
video: !v ? void 0 : {
|
|
4945
4953
|
codec: (_v$codec = v.codec) === null || _v$codec === void 0 ? void 0 : _v$codec.mimeType,
|
|
4946
4954
|
payloadType: (_v$codec2 = v.codec) === null || _v$codec2 === void 0 ? void 0 : _v$codec2.payloadType,
|
|
4947
4955
|
sdpFmtpLine: (_v$codec3 = v.codec) === null || _v$codec3 === void 0 ? void 0 : _v$codec3.sdpFmtpLine,
|
|
4948
|
-
bytesReceived: ((_v$
|
|
4949
|
-
firCount: (_v$
|
|
4950
|
-
pliCount: (_v$
|
|
4951
|
-
frameHeight: (_v$
|
|
4952
|
-
frameWidth: (_v$
|
|
4953
|
-
framesDecoded: (_v$
|
|
4954
|
-
framesDropped: (_v$
|
|
4955
|
-
framesPerSecond: (_v$
|
|
4956
|
-
framesReceived: (_v$
|
|
4957
|
-
jitter: (_v$
|
|
4958
|
-
jitterBufferDelay: (_v$
|
|
4959
|
-
keyFramesDecoded: (_v$
|
|
4960
|
-
nackCount: (_v$
|
|
4961
|
-
packetsLost: ((_v$
|
|
4962
|
-
packetsReceived: ((_v$
|
|
4956
|
+
bytesReceived: ((_v$inboundRtp4 = v.inboundRtp) === null || _v$inboundRtp4 === void 0 ? void 0 : _v$inboundRtp4.bytesReceived) || 0,
|
|
4957
|
+
firCount: (_v$inboundRtp5 = v.inboundRtp) === null || _v$inboundRtp5 === void 0 ? void 0 : _v$inboundRtp5.firCount,
|
|
4958
|
+
pliCount: (_v$inboundRtp6 = v.inboundRtp) === null || _v$inboundRtp6 === void 0 ? void 0 : _v$inboundRtp6.pliCount,
|
|
4959
|
+
frameHeight: (_v$inboundRtp7 = v.inboundRtp) === null || _v$inboundRtp7 === void 0 ? void 0 : _v$inboundRtp7.frameHeight,
|
|
4960
|
+
frameWidth: (_v$inboundRtp8 = v.inboundRtp) === null || _v$inboundRtp8 === void 0 ? void 0 : _v$inboundRtp8.frameWidth,
|
|
4961
|
+
framesDecoded: (_v$inboundRtp9 = v.inboundRtp) === null || _v$inboundRtp9 === void 0 ? void 0 : _v$inboundRtp9.framesDecoded,
|
|
4962
|
+
framesDropped: (_v$inboundRtp10 = v.inboundRtp) === null || _v$inboundRtp10 === void 0 ? void 0 : _v$inboundRtp10.framesDropped,
|
|
4963
|
+
framesPerSecond: (_v$inboundRtp11 = v.inboundRtp) === null || _v$inboundRtp11 === void 0 ? void 0 : _v$inboundRtp11.framesPerSecond,
|
|
4964
|
+
framesReceived: (_v$inboundRtp$framesR = (_v$inboundRtp12 = v.inboundRtp) === null || _v$inboundRtp12 === void 0 ? void 0 : _v$inboundRtp12.framesReceived) !== null && _v$inboundRtp$framesR !== void 0 ? _v$inboundRtp$framesR : (_v$track = v.track) === null || _v$track === void 0 ? void 0 : _v$track.framesReceived,
|
|
4965
|
+
jitter: (_v$inboundRtp13 = v.inboundRtp) === null || _v$inboundRtp13 === void 0 ? void 0 : _v$inboundRtp13.jitter,
|
|
4966
|
+
jitterBufferDelay: (_v$inboundRtp14 = v.inboundRtp) === null || _v$inboundRtp14 === void 0 ? void 0 : _v$inboundRtp14.jitterBufferDelay,
|
|
4967
|
+
keyFramesDecoded: (_v$inboundRtp15 = v.inboundRtp) === null || _v$inboundRtp15 === void 0 ? void 0 : _v$inboundRtp15.keyFramesDecoded,
|
|
4968
|
+
nackCount: (_v$inboundRtp16 = v.inboundRtp) === null || _v$inboundRtp16 === void 0 ? void 0 : _v$inboundRtp16.nackCount,
|
|
4969
|
+
packetsLost: ((_v$inboundRtp17 = v.inboundRtp) === null || _v$inboundRtp17 === void 0 ? void 0 : _v$inboundRtp17.packetsLost) || 0,
|
|
4970
|
+
packetsReceived: ((_v$inboundRtp18 = v.inboundRtp) === null || _v$inboundRtp18 === void 0 ? void 0 : _v$inboundRtp18.packetsReceived) || 0,
|
|
4971
|
+
averageJitterBufferDelay
|
|
4963
4972
|
},
|
|
4964
4973
|
audio: !a ? void 0 : {
|
|
4965
4974
|
codec: (_a$codec = a.codec) === null || _a$codec === void 0 ? void 0 : _a$codec.mimeType,
|
|
@@ -4982,7 +4991,7 @@ var QUEUE_SIZE = 5;
|
|
|
4982
4991
|
var NetworkEvaluate = /* @__PURE__ */ function() {
|
|
4983
4992
|
function NetworkEvaluate2(pc, interval) {
|
|
4984
4993
|
var _this = this;
|
|
4985
|
-
_classCallCheck$
|
|
4994
|
+
_classCallCheck$3(this, NetworkEvaluate2);
|
|
4986
4995
|
_defineProperty$2(this, "_pc", null);
|
|
4987
4996
|
_defineProperty$2(this, "_lastVideoStats", null);
|
|
4988
4997
|
_defineProperty$2(this, "_lastRemoteVideoStats", null);
|
|
@@ -5045,7 +5054,7 @@ var NetworkEvaluate = /* @__PURE__ */ function() {
|
|
|
5045
5054
|
this._timerInterval = interval;
|
|
5046
5055
|
this.start(interval);
|
|
5047
5056
|
}
|
|
5048
|
-
_createClass$
|
|
5057
|
+
_createClass$3(NetworkEvaluate2, [{
|
|
5049
5058
|
key: "start",
|
|
5050
5059
|
value: function start(interval) {
|
|
5051
5060
|
clearInterval(this._timer);
|
|
@@ -5131,13 +5140,640 @@ var NetworkEvaluate = /* @__PURE__ */ function() {
|
|
|
5131
5140
|
}]);
|
|
5132
5141
|
return NetworkEvaluate2;
|
|
5133
5142
|
}();
|
|
5143
|
+
function isSupported() {
|
|
5144
|
+
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
5145
|
+
return false;
|
|
5146
|
+
}
|
|
5147
|
+
return true;
|
|
5148
|
+
}
|
|
5149
|
+
function getCapacity() {
|
|
5150
|
+
if (!isSupported())
|
|
5151
|
+
return Promise.reject("RTCPeerConnection no support");
|
|
5152
|
+
var pc;
|
|
5153
|
+
try {
|
|
5154
|
+
pc = new RTCPeerConnection();
|
|
5155
|
+
pc.addTransceiver("video", {
|
|
5156
|
+
direction: "recvonly"
|
|
5157
|
+
});
|
|
5158
|
+
pc.addTransceiver("audio", {
|
|
5159
|
+
direction: "recvonly"
|
|
5160
|
+
});
|
|
5161
|
+
} catch (e) {
|
|
5162
|
+
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
5163
|
+
}
|
|
5164
|
+
return pc.createOffer().then(function(offer) {
|
|
5165
|
+
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
5166
|
+
logger.log(offer.sdp);
|
|
5167
|
+
var sdpJson = lib.parse(offer.sdp);
|
|
5168
|
+
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x) {
|
|
5169
|
+
return x.type === "video";
|
|
5170
|
+
})[0];
|
|
5171
|
+
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x) {
|
|
5172
|
+
return x.type === "audio";
|
|
5173
|
+
})[0];
|
|
5174
|
+
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x) {
|
|
5175
|
+
return x.codec === "VP8" || x.codec === "VP9" || x.codec === "H264";
|
|
5176
|
+
});
|
|
5177
|
+
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x) {
|
|
5178
|
+
return x.codec === "opus";
|
|
5179
|
+
});
|
|
5180
|
+
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
5181
|
+
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
5182
|
+
vFmtp && vCodecs.map(function(codec) {
|
|
5183
|
+
var _vFmtp$filter$;
|
|
5184
|
+
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x) {
|
|
5185
|
+
return x.payload === codec.payload;
|
|
5186
|
+
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
5187
|
+
});
|
|
5188
|
+
aFmtp && aCodecs.map(function(codec) {
|
|
5189
|
+
var _aFmtp$filter$;
|
|
5190
|
+
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x) {
|
|
5191
|
+
return x.payload === codec.payload;
|
|
5192
|
+
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
5193
|
+
});
|
|
5194
|
+
pc.close();
|
|
5195
|
+
return {
|
|
5196
|
+
video: vCodecs,
|
|
5197
|
+
audio: aCodecs
|
|
5198
|
+
};
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5201
|
+
var isEncodedTransformSupported = function isEncodedTransformSupported2() {
|
|
5202
|
+
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpScriptTransform !== "undefined" && "transform" in RTCRtpSender.prototype && "transform" in RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
|
|
5203
|
+
};
|
|
5204
|
+
var isWorkerSupported = function isWorkerSupported2() {
|
|
5205
|
+
return typeof window !== "undefined" && window.Worker;
|
|
5206
|
+
};
|
|
5207
|
+
var isMessageChannelSupported = function isMessageChannelSupported2() {
|
|
5208
|
+
return typeof MessageChannel !== "undefined";
|
|
5209
|
+
};
|
|
5210
|
+
var isLegacyEncodedTransformSupported = function isLegacyEncodedTransformSupported2() {
|
|
5211
|
+
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
5212
|
+
};
|
|
5213
|
+
var Nalunit = {
|
|
5214
|
+
getNALUnits: function getNALUnits(buffer) {
|
|
5215
|
+
var isH265 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
5216
|
+
if (buffer.length - buffer.position < 4) {
|
|
5217
|
+
return [];
|
|
5218
|
+
}
|
|
5219
|
+
var position = buffer.position;
|
|
5220
|
+
if (buffer.getInt32(position) === 1 || buffer.getInt16(position) === 0 && buffer.getInt8(position + 2) === 1) {
|
|
5221
|
+
return Nalunit.getAnnexbNals(buffer, isH265);
|
|
5222
|
+
} else {
|
|
5223
|
+
return Nalunit.getAvccNals(buffer, isH265);
|
|
5224
|
+
}
|
|
5225
|
+
},
|
|
5226
|
+
getAnnexbNals: function getAnnexbNals(buffer, isH265) {
|
|
5227
|
+
var nals = [];
|
|
5228
|
+
var position = Nalunit.getHeaderPositionAnnexB(buffer);
|
|
5229
|
+
var start = position.pos;
|
|
5230
|
+
var end = start;
|
|
5231
|
+
while (start < buffer.length - 4) {
|
|
5232
|
+
var header = new Uint8Array(buffer.buffer.slice(start, start + position.headerLength));
|
|
5233
|
+
if (position.pos === buffer.position) {
|
|
5234
|
+
buffer.skip(position.headerLength);
|
|
5235
|
+
}
|
|
5236
|
+
position = Nalunit.getHeaderPositionAnnexB(buffer);
|
|
5237
|
+
end = position.pos;
|
|
5238
|
+
var body = new Uint8Array(buffer.buffer.slice(start + header.byteLength, end));
|
|
5239
|
+
var unit = {
|
|
5240
|
+
header,
|
|
5241
|
+
body,
|
|
5242
|
+
type: -1
|
|
5243
|
+
};
|
|
5244
|
+
isH265 ? Nalunit.analyseH265Nal(unit) : Nalunit.analyseNal(unit);
|
|
5245
|
+
if ((unit.type <= 9 || isH265 && unit.type <= 40) && unit.type !== 0) {
|
|
5246
|
+
nals.push(unit);
|
|
5247
|
+
}
|
|
5248
|
+
buffer.skip(end - buffer.position);
|
|
5249
|
+
start = end;
|
|
5250
|
+
}
|
|
5251
|
+
return nals;
|
|
5252
|
+
},
|
|
5253
|
+
getAvccNals: function getAvccNals(buffer, isH265) {
|
|
5254
|
+
var nals = [];
|
|
5255
|
+
while (buffer.position < buffer.length - 4) {
|
|
5256
|
+
var length = buffer.getInt32(buffer.position);
|
|
5257
|
+
if (buffer.length - buffer.position >= length) {
|
|
5258
|
+
var header = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + 4));
|
|
5259
|
+
buffer.skip(4);
|
|
5260
|
+
var body = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + length));
|
|
5261
|
+
buffer.skip(length);
|
|
5262
|
+
var unit = {
|
|
5263
|
+
header,
|
|
5264
|
+
body,
|
|
5265
|
+
type: -1
|
|
5266
|
+
};
|
|
5267
|
+
isH265 ? Nalunit.analyseH265Nal(unit) : Nalunit.analyseNal(unit);
|
|
5268
|
+
if (unit.type <= 9 && unit.type !== 0) {
|
|
5269
|
+
nals.push(unit);
|
|
5270
|
+
}
|
|
5271
|
+
} else {
|
|
5272
|
+
break;
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
return nals;
|
|
5276
|
+
},
|
|
5277
|
+
analyseNal: function analyseNal(unit) {
|
|
5278
|
+
var type = unit.body[0] & 31;
|
|
5279
|
+
unit.type = type;
|
|
5280
|
+
switch (type) {
|
|
5281
|
+
case 1:
|
|
5282
|
+
unit.ndr = true;
|
|
5283
|
+
break;
|
|
5284
|
+
case 5:
|
|
5285
|
+
unit.idr = true;
|
|
5286
|
+
break;
|
|
5287
|
+
case 6:
|
|
5288
|
+
unit.sei = true;
|
|
5289
|
+
break;
|
|
5290
|
+
case 7:
|
|
5291
|
+
unit.sps = true;
|
|
5292
|
+
break;
|
|
5293
|
+
case 8:
|
|
5294
|
+
unit.pps = true;
|
|
5295
|
+
break;
|
|
5296
|
+
}
|
|
5297
|
+
},
|
|
5298
|
+
analyseH265Nal: function analyseH265Nal(unit) {
|
|
5299
|
+
var type = (unit.body[0] & 126) >> 1;
|
|
5300
|
+
unit.type = type;
|
|
5301
|
+
switch (type) {
|
|
5302
|
+
case 39:
|
|
5303
|
+
case 40:
|
|
5304
|
+
unit.sei = true;
|
|
5305
|
+
break;
|
|
5306
|
+
}
|
|
5307
|
+
},
|
|
5308
|
+
getHeaderPositionAnnexB: function getHeaderPositionAnnexB(buffer) {
|
|
5309
|
+
var pos = buffer.position;
|
|
5310
|
+
var headerLength = 0;
|
|
5311
|
+
var bufferLen = buffer.length;
|
|
5312
|
+
while (headerLength !== 3 && headerLength !== 4 && pos < bufferLen - 4) {
|
|
5313
|
+
if (buffer.getInt16(pos) === 0) {
|
|
5314
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
5315
|
+
headerLength = 4;
|
|
5316
|
+
} else if (buffer.getInt8(pos + 2) === 1) {
|
|
5317
|
+
headerLength = 3;
|
|
5318
|
+
} else {
|
|
5319
|
+
pos++;
|
|
5320
|
+
}
|
|
5321
|
+
} else {
|
|
5322
|
+
pos++;
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
if (pos === bufferLen - 4) {
|
|
5326
|
+
if (buffer.getInt16(pos) === 0) {
|
|
5327
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
5328
|
+
headerLength = 4;
|
|
5329
|
+
} else {
|
|
5330
|
+
pos = bufferLen;
|
|
5331
|
+
}
|
|
5332
|
+
} else {
|
|
5333
|
+
pos++;
|
|
5334
|
+
if (buffer.getInt16(pos) === 0 && buffer.getInt8(pos) === 1) {
|
|
5335
|
+
headerLength = 3;
|
|
5336
|
+
} else {
|
|
5337
|
+
pos = bufferLen;
|
|
5338
|
+
}
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
return {
|
|
5342
|
+
pos,
|
|
5343
|
+
headerLength
|
|
5344
|
+
};
|
|
5345
|
+
},
|
|
5346
|
+
isH265VideoFrame: function isH265VideoFrame(chunk) {
|
|
5347
|
+
var _chunk$getMetadata, _chunk$getMetadata$ca;
|
|
5348
|
+
return (((_chunk$getMetadata = chunk.getMetadata) === null || _chunk$getMetadata === void 0 ? void 0 : (_chunk$getMetadata$ca = _chunk$getMetadata.call(chunk)) === null || _chunk$getMetadata$ca === void 0 ? void 0 : _chunk$getMetadata$ca.mimeType) || "").toLowerCase().includes("h265");
|
|
5349
|
+
}
|
|
5350
|
+
};
|
|
5351
|
+
var RTCDataView = /* @__PURE__ */ function() {
|
|
5352
|
+
function RTCDataView2(buffer) {
|
|
5353
|
+
_classCallCheck$3(this, RTCDataView2);
|
|
5354
|
+
_defineProperty$2(this, "_position", 0);
|
|
5355
|
+
this._dataview = new DataView(buffer);
|
|
5356
|
+
}
|
|
5357
|
+
_createClass$3(RTCDataView2, [{
|
|
5358
|
+
key: "length",
|
|
5359
|
+
get: function get() {
|
|
5360
|
+
return this.buffer.byteLength;
|
|
5361
|
+
}
|
|
5362
|
+
}, {
|
|
5363
|
+
key: "buffer",
|
|
5364
|
+
get: function get() {
|
|
5365
|
+
return this._dataview.buffer;
|
|
5366
|
+
}
|
|
5367
|
+
}, {
|
|
5368
|
+
key: "position",
|
|
5369
|
+
get: function get() {
|
|
5370
|
+
return this._position;
|
|
5371
|
+
},
|
|
5372
|
+
set: function set(value) {
|
|
5373
|
+
this._position = value;
|
|
5374
|
+
}
|
|
5375
|
+
}, {
|
|
5376
|
+
key: "back",
|
|
5377
|
+
value: function back(count) {
|
|
5378
|
+
this.position -= count;
|
|
5379
|
+
}
|
|
5380
|
+
}, {
|
|
5381
|
+
key: "getUint8",
|
|
5382
|
+
value: function getUint8(offset) {
|
|
5383
|
+
return this._dataview.getUint8(offset);
|
|
5384
|
+
}
|
|
5385
|
+
}, {
|
|
5386
|
+
key: "getInt8",
|
|
5387
|
+
value: function getInt8(offset) {
|
|
5388
|
+
return this._dataview.getInt8(offset);
|
|
5389
|
+
}
|
|
5390
|
+
}, {
|
|
5391
|
+
key: "getInt16",
|
|
5392
|
+
value: function getInt16(offset) {
|
|
5393
|
+
return this._dataview.getInt16(offset);
|
|
5394
|
+
}
|
|
5395
|
+
}, {
|
|
5396
|
+
key: "getUint16",
|
|
5397
|
+
value: function getUint16(offset) {
|
|
5398
|
+
return this._dataview.getUint16(offset);
|
|
5399
|
+
}
|
|
5400
|
+
}, {
|
|
5401
|
+
key: "getUint32",
|
|
5402
|
+
value: function getUint32(offset) {
|
|
5403
|
+
return this._dataview.getUint32(offset);
|
|
5404
|
+
}
|
|
5405
|
+
}, {
|
|
5406
|
+
key: "getInt32",
|
|
5407
|
+
value: function getInt32(offset) {
|
|
5408
|
+
return this._dataview.getInt32(offset);
|
|
5409
|
+
}
|
|
5410
|
+
}, {
|
|
5411
|
+
key: "skip",
|
|
5412
|
+
value: function skip(count) {
|
|
5413
|
+
var loop = Math.floor(count / 4);
|
|
5414
|
+
var last = count % 4;
|
|
5415
|
+
for (var i = 0; i < loop; i++) {
|
|
5416
|
+
RTCDataView2.readByte(this, 4);
|
|
5417
|
+
}
|
|
5418
|
+
if (last > 0) {
|
|
5419
|
+
RTCDataView2.readByte(this, last);
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
}, {
|
|
5423
|
+
key: "readUint8",
|
|
5424
|
+
value: function readUint8() {
|
|
5425
|
+
return RTCDataView2.readByte(this, 1);
|
|
5426
|
+
}
|
|
5427
|
+
}, {
|
|
5428
|
+
key: "readUint16",
|
|
5429
|
+
value: function readUint16() {
|
|
5430
|
+
return RTCDataView2.readByte(this, 2);
|
|
5431
|
+
}
|
|
5432
|
+
}, {
|
|
5433
|
+
key: "readUint24",
|
|
5434
|
+
value: function readUint24() {
|
|
5435
|
+
return RTCDataView2.readByte(this, 3);
|
|
5436
|
+
}
|
|
5437
|
+
}, {
|
|
5438
|
+
key: "readUint32",
|
|
5439
|
+
value: function readUint32() {
|
|
5440
|
+
return RTCDataView2.readByte(this, 4);
|
|
5441
|
+
}
|
|
5442
|
+
}, {
|
|
5443
|
+
key: "readUint64",
|
|
5444
|
+
value: function readUint64() {
|
|
5445
|
+
return RTCDataView2.readByte(this, 8);
|
|
5446
|
+
}
|
|
5447
|
+
}, {
|
|
5448
|
+
key: "readInt8",
|
|
5449
|
+
value: function readInt8() {
|
|
5450
|
+
return RTCDataView2.readByte(this, 1, true);
|
|
5451
|
+
}
|
|
5452
|
+
}, {
|
|
5453
|
+
key: "readInt16",
|
|
5454
|
+
value: function readInt16() {
|
|
5455
|
+
return RTCDataView2.readByte(this, 2, true);
|
|
5456
|
+
}
|
|
5457
|
+
}, {
|
|
5458
|
+
key: "readInt32",
|
|
5459
|
+
value: function readInt32() {
|
|
5460
|
+
return RTCDataView2.readByte(this, 4, true);
|
|
5461
|
+
}
|
|
5462
|
+
}, {
|
|
5463
|
+
key: "writeUint32",
|
|
5464
|
+
value: function writeUint32(value) {
|
|
5465
|
+
return new Uint8Array([value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255]);
|
|
5466
|
+
}
|
|
5467
|
+
}], [{
|
|
5468
|
+
key: "readByte",
|
|
5469
|
+
value: function readByte(buffer, size, sign) {
|
|
5470
|
+
var res;
|
|
5471
|
+
switch (size) {
|
|
5472
|
+
case 1:
|
|
5473
|
+
if (sign) {
|
|
5474
|
+
res = buffer.getInt8(buffer.position);
|
|
5475
|
+
} else {
|
|
5476
|
+
res = buffer.getUint8(buffer.position);
|
|
5477
|
+
}
|
|
5478
|
+
break;
|
|
5479
|
+
case 2:
|
|
5480
|
+
if (sign) {
|
|
5481
|
+
res = buffer.getInt16(buffer.position);
|
|
5482
|
+
} else {
|
|
5483
|
+
res = buffer.getUint16(buffer.position);
|
|
5484
|
+
}
|
|
5485
|
+
break;
|
|
5486
|
+
case 3:
|
|
5487
|
+
if (sign) {
|
|
5488
|
+
throw new Error("not supported for readByte 3");
|
|
5489
|
+
} else {
|
|
5490
|
+
res = buffer.getUint8(buffer.position) << 16;
|
|
5491
|
+
res |= buffer.getUint8(buffer.position + 1) << 8;
|
|
5492
|
+
res |= buffer.getUint8(buffer.position + 2);
|
|
5493
|
+
}
|
|
5494
|
+
break;
|
|
5495
|
+
case 4:
|
|
5496
|
+
if (sign) {
|
|
5497
|
+
res = buffer.getInt32(buffer.position);
|
|
5498
|
+
} else {
|
|
5499
|
+
res = buffer.getUint32(buffer.position);
|
|
5500
|
+
}
|
|
5501
|
+
break;
|
|
5502
|
+
case 8:
|
|
5503
|
+
if (sign) {
|
|
5504
|
+
throw new Error("not supported for readBody 8");
|
|
5505
|
+
} else {
|
|
5506
|
+
res = buffer.getUint32(buffer.position) << 32;
|
|
5507
|
+
res |= buffer.getUint32(buffer.position + 4);
|
|
5508
|
+
}
|
|
5509
|
+
break;
|
|
5510
|
+
default:
|
|
5511
|
+
res = "";
|
|
5512
|
+
}
|
|
5513
|
+
buffer.position += size;
|
|
5514
|
+
return res;
|
|
5515
|
+
}
|
|
5516
|
+
}]);
|
|
5517
|
+
return RTCDataView2;
|
|
5518
|
+
}();
|
|
5519
|
+
function _classCallCheck(instance, Constructor) {
|
|
5520
|
+
if (!(instance instanceof Constructor)) {
|
|
5521
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
function _defineProperties(target, props) {
|
|
5525
|
+
for (var i = 0; i < props.length; i++) {
|
|
5526
|
+
var descriptor = props[i];
|
|
5527
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
5528
|
+
descriptor.configurable = true;
|
|
5529
|
+
if ("value" in descriptor)
|
|
5530
|
+
descriptor.writable = true;
|
|
5531
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
5535
|
+
if (protoProps)
|
|
5536
|
+
_defineProperties(Constructor.prototype, protoProps);
|
|
5537
|
+
if (staticProps)
|
|
5538
|
+
_defineProperties(Constructor, staticProps);
|
|
5539
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
5540
|
+
writable: false
|
|
5541
|
+
});
|
|
5542
|
+
return Constructor;
|
|
5543
|
+
}
|
|
5544
|
+
function _toPrimitive(input, hint) {
|
|
5545
|
+
if (typeof input !== "object" || input === null)
|
|
5546
|
+
return input;
|
|
5547
|
+
var prim = input[Symbol.toPrimitive];
|
|
5548
|
+
if (prim !== void 0) {
|
|
5549
|
+
var res = prim.call(input, hint || "default");
|
|
5550
|
+
if (typeof res !== "object")
|
|
5551
|
+
return res;
|
|
5552
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5553
|
+
}
|
|
5554
|
+
return (hint === "string" ? String : Number)(input);
|
|
5555
|
+
}
|
|
5556
|
+
function _toPropertyKey(arg) {
|
|
5557
|
+
var key = _toPrimitive(arg, "string");
|
|
5558
|
+
return typeof key === "symbol" ? key : String(key);
|
|
5559
|
+
}
|
|
5560
|
+
function readBig32(data) {
|
|
5561
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
5562
|
+
return (data[i] << 24 >>> 0) + (data[i + 1] << 16) + (data[i + 2] << 8) + (data[i + 3] || 0);
|
|
5563
|
+
}
|
|
5564
|
+
var NALu = /* @__PURE__ */ function() {
|
|
5565
|
+
function NALu2() {
|
|
5566
|
+
_classCallCheck(this, NALu2);
|
|
5567
|
+
}
|
|
5568
|
+
_createClass(NALu2, null, [{
|
|
5569
|
+
key: "parseAnnexB",
|
|
5570
|
+
value: function parseAnnexB(data) {
|
|
5571
|
+
var j = data.byteLength - 1;
|
|
5572
|
+
var dropZerosLength = 0;
|
|
5573
|
+
do {
|
|
5574
|
+
if (data[j] === 0) {
|
|
5575
|
+
dropZerosLength++;
|
|
5576
|
+
} else {
|
|
5577
|
+
break;
|
|
5578
|
+
}
|
|
5579
|
+
j--;
|
|
5580
|
+
} while (j > 0);
|
|
5581
|
+
if (dropZerosLength >= 3) {
|
|
5582
|
+
data = data.subarray(0, j + 1);
|
|
5583
|
+
}
|
|
5584
|
+
var len = data.length;
|
|
5585
|
+
var start = 2;
|
|
5586
|
+
var end = 0;
|
|
5587
|
+
while (data[start] !== null && data[start] !== void 0 && data[start] !== 1) {
|
|
5588
|
+
start++;
|
|
5589
|
+
}
|
|
5590
|
+
start++;
|
|
5591
|
+
end = start + 2;
|
|
5592
|
+
if (end >= len)
|
|
5593
|
+
return [];
|
|
5594
|
+
var units = [];
|
|
5595
|
+
while (end < len) {
|
|
5596
|
+
switch (data[end]) {
|
|
5597
|
+
case 0:
|
|
5598
|
+
if (data[end - 1] !== 0) {
|
|
5599
|
+
end += 2;
|
|
5600
|
+
break;
|
|
5601
|
+
} else if (data[end - 2] !== 0) {
|
|
5602
|
+
end++;
|
|
5603
|
+
break;
|
|
5604
|
+
} else if (end < len - 1 && data[end + 1] !== 1) {
|
|
5605
|
+
end++;
|
|
5606
|
+
break;
|
|
5607
|
+
}
|
|
5608
|
+
if (start !== end - 2)
|
|
5609
|
+
units.push(data.subarray(start, end - 2));
|
|
5610
|
+
do {
|
|
5611
|
+
end++;
|
|
5612
|
+
} while (data[end] !== 1 && end < len);
|
|
5613
|
+
start = end + 1;
|
|
5614
|
+
end = start + 2;
|
|
5615
|
+
break;
|
|
5616
|
+
case 1:
|
|
5617
|
+
if (data[end - 1] !== 0 || data[end - 2] !== 0) {
|
|
5618
|
+
end += 3;
|
|
5619
|
+
break;
|
|
5620
|
+
}
|
|
5621
|
+
if (start !== end - 2)
|
|
5622
|
+
units.push(data.subarray(start, end - 2));
|
|
5623
|
+
start = end + 1;
|
|
5624
|
+
end = start + 2;
|
|
5625
|
+
break;
|
|
5626
|
+
default:
|
|
5627
|
+
end += 3;
|
|
5628
|
+
break;
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
if (start < len)
|
|
5632
|
+
units.push(data.subarray(start));
|
|
5633
|
+
return units;
|
|
5634
|
+
}
|
|
5635
|
+
}, {
|
|
5636
|
+
key: "parseAvcC",
|
|
5637
|
+
value: function parseAvcC(data) {
|
|
5638
|
+
var size = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
|
|
5639
|
+
if (data.length < 4)
|
|
5640
|
+
return;
|
|
5641
|
+
var dataLen = data.length;
|
|
5642
|
+
var units = [];
|
|
5643
|
+
var offset = 0;
|
|
5644
|
+
var length;
|
|
5645
|
+
while (offset + size < dataLen) {
|
|
5646
|
+
length = readBig32(data, offset);
|
|
5647
|
+
if (size === 3)
|
|
5648
|
+
length >>>= 8;
|
|
5649
|
+
offset += size;
|
|
5650
|
+
if (!length)
|
|
5651
|
+
continue;
|
|
5652
|
+
if (offset + length > dataLen) {
|
|
5653
|
+
break;
|
|
5654
|
+
}
|
|
5655
|
+
units.push(data.subarray(offset, offset + length));
|
|
5656
|
+
offset += length;
|
|
5657
|
+
}
|
|
5658
|
+
return units;
|
|
5659
|
+
}
|
|
5660
|
+
}, {
|
|
5661
|
+
key: "parseSEI",
|
|
5662
|
+
value: function parseSEI(unit, isHevc) {
|
|
5663
|
+
var len = unit.length;
|
|
5664
|
+
var i = isHevc ? 2 : 1;
|
|
5665
|
+
var type = 0;
|
|
5666
|
+
var size = 0;
|
|
5667
|
+
var uuid = "";
|
|
5668
|
+
while (unit[i] === 255) {
|
|
5669
|
+
type += 255;
|
|
5670
|
+
i++;
|
|
5671
|
+
}
|
|
5672
|
+
type += unit[i++];
|
|
5673
|
+
while (unit[i] === 255) {
|
|
5674
|
+
size += 255;
|
|
5675
|
+
i++;
|
|
5676
|
+
}
|
|
5677
|
+
size += unit[i++];
|
|
5678
|
+
if (type === 5 && len > i + 16) {
|
|
5679
|
+
for (var j = 0; j < 16; j++) {
|
|
5680
|
+
uuid += unit[i].toString(16);
|
|
5681
|
+
i++;
|
|
5682
|
+
}
|
|
5683
|
+
}
|
|
5684
|
+
return {
|
|
5685
|
+
payload: unit.subarray(i, i + size),
|
|
5686
|
+
type,
|
|
5687
|
+
size,
|
|
5688
|
+
uuid
|
|
5689
|
+
};
|
|
5690
|
+
}
|
|
5691
|
+
}, {
|
|
5692
|
+
key: "removeEPB",
|
|
5693
|
+
value: function removeEPB(uint) {
|
|
5694
|
+
var length = uint.byteLength;
|
|
5695
|
+
var emulationPreventionBytesPositions = [];
|
|
5696
|
+
var i = 1;
|
|
5697
|
+
while (i < length - 2) {
|
|
5698
|
+
if (uint[i] === 0 && uint[i + 1] === 0 && uint[i + 2] === 3) {
|
|
5699
|
+
emulationPreventionBytesPositions.push(i + 2);
|
|
5700
|
+
i += 2;
|
|
5701
|
+
} else {
|
|
5702
|
+
i++;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
if (!emulationPreventionBytesPositions.length)
|
|
5706
|
+
return uint;
|
|
5707
|
+
var newLength = length - emulationPreventionBytesPositions.length;
|
|
5708
|
+
var newData = new Uint8Array(newLength);
|
|
5709
|
+
var sourceIndex = 0;
|
|
5710
|
+
for (i = 0; i < newLength; sourceIndex++, i++) {
|
|
5711
|
+
if (sourceIndex === emulationPreventionBytesPositions[0]) {
|
|
5712
|
+
sourceIndex++;
|
|
5713
|
+
emulationPreventionBytesPositions.shift();
|
|
5714
|
+
}
|
|
5715
|
+
newData[i] = uint[sourceIndex];
|
|
5716
|
+
}
|
|
5717
|
+
return newData;
|
|
5718
|
+
}
|
|
5719
|
+
}]);
|
|
5720
|
+
return NALu2;
|
|
5721
|
+
}();
|
|
5722
|
+
function receiveSEITransform(postMessage) {
|
|
5723
|
+
var transform = new TransformStream({
|
|
5724
|
+
transform: function transform2(encodedFrame, controller) {
|
|
5725
|
+
var isH265 = Nalunit.isH265VideoFrame(encodedFrame);
|
|
5726
|
+
var NALs = Nalunit.getNALUnits(new RTCDataView(encodedFrame.data), isH265);
|
|
5727
|
+
NALs.forEach(function(nalUnit) {
|
|
5728
|
+
if (nalUnit.sei) {
|
|
5729
|
+
var decodedSei = NALu.parseSEI(NALu.removeEPB(nalUnit.body), false);
|
|
5730
|
+
if (decodedSei) {
|
|
5731
|
+
postMessage({
|
|
5732
|
+
data: decodedSei,
|
|
5733
|
+
sei: {
|
|
5734
|
+
code: decodedSei.type,
|
|
5735
|
+
content: decodedSei.payload
|
|
5736
|
+
}
|
|
5737
|
+
});
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5740
|
+
});
|
|
5741
|
+
controller.enqueue(encodedFrame);
|
|
5742
|
+
}
|
|
5743
|
+
});
|
|
5744
|
+
return transform;
|
|
5745
|
+
}
|
|
5746
|
+
if (typeof self !== "undefined" && self.constructor.name === "DedicatedWorkerGlobalScope") {
|
|
5747
|
+
self.addEventListener("rtctransform", function(event) {
|
|
5748
|
+
var transformer = event.transformer;
|
|
5749
|
+
var port = transformer.options.port;
|
|
5750
|
+
var transform = receiveSEITransform(function(msg) {
|
|
5751
|
+
port.postMessage(msg);
|
|
5752
|
+
});
|
|
5753
|
+
transformer.readable.pipeThrough(transform).pipeTo(event.transformer.writable);
|
|
5754
|
+
});
|
|
5755
|
+
}
|
|
5756
|
+
var encodedJs = "IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPXtnZXROQUxVbml0czpmdW5jdGlvbih0KXt2YXIgbj1hcmd1bWVudHMubGVuZ3RoPjEmJnZvaWQgMCE9PWFyZ3VtZW50c1sxXSYmYXJndW1lbnRzWzFdO2lmKHQubGVuZ3RoLXQucG9zaXRpb248NClyZXR1cm5bXTt2YXIgcj10LnBvc2l0aW9uO3JldH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xyKXt2YXIgYT1lLmlzSDI2NVZpZGVvRnJhbWUodCk7ZS5nZXROQUxVbml0cyhuZXcgaSh0LmRhdGEpLGEpLmZvckVhY2goKGZ1bmN0aW9uKGUpe2lmKGUuc2VpKXt2YXIgdD11LnBhcnNlU0VJKHUucmVtb3ZlRVBCKGUuYm9keSksITEpO3QmJm4oe2RhdGE6dCxzZWk6e2NvZGU6dC50eXBlLGNvbnRlbnQ6dC5wYXlsb2FkfX0pfX0pKSxyLmVucXVldWUodCl9fSkpO3IucmVhZGFibGUucGlwZVRocm91Z2gobykucGlwZVRvKHQudHJhbnNmb3JtZXIud3JpdGFibGUpfSkpfSgpOwo=";
|
|
5757
|
+
var blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], {
|
|
5758
|
+
type: "text/javascript;charset=utf-8"
|
|
5759
|
+
});
|
|
5760
|
+
function WorkerWrapper() {
|
|
5761
|
+
var objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);
|
|
5762
|
+
try {
|
|
5763
|
+
return objURL ? new Worker(objURL, {}) : new Worker("data:application/javascript;base64," + encodedJs, {
|
|
5764
|
+
type: "module"
|
|
5765
|
+
});
|
|
5766
|
+
} finally {
|
|
5767
|
+
objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5134
5770
|
var logger = new Logger("rts");
|
|
5135
5771
|
var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
5136
5772
|
_inherits$1(Rts2, _EventEmitter);
|
|
5137
5773
|
var _super = _createSuper$1(Rts2);
|
|
5138
5774
|
function Rts2(opts) {
|
|
5139
5775
|
var _this;
|
|
5140
|
-
_classCallCheck$
|
|
5776
|
+
_classCallCheck$3(this, Rts2);
|
|
5141
5777
|
_this = _super.call(this);
|
|
5142
5778
|
_defineProperty$2(_assertThisInitialized$1(_this), "_url", "");
|
|
5143
5779
|
_defineProperty$2(_assertThisInitialized$1(_this), "_pc", null);
|
|
@@ -5153,6 +5789,46 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5153
5789
|
_defineProperty$2(_assertThisInitialized$1(_this), "_waitingTimer", 0);
|
|
5154
5790
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rctConnectStartTs", 0);
|
|
5155
5791
|
_defineProperty$2(_assertThisInitialized$1(_this), "_isReplacing", false);
|
|
5792
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsErrorTimer", null);
|
|
5793
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
5794
|
+
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
5795
|
+
while (1)
|
|
5796
|
+
switch (_context2.prev = _context2.next) {
|
|
5797
|
+
case 0:
|
|
5798
|
+
_this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
5799
|
+
var stats, _stats$video, framesDecoded, bytesReceived;
|
|
5800
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
5801
|
+
while (1)
|
|
5802
|
+
switch (_context.prev = _context.next) {
|
|
5803
|
+
case 0:
|
|
5804
|
+
_context.next = 2;
|
|
5805
|
+
return _this.getStatsSnapshoot();
|
|
5806
|
+
case 2:
|
|
5807
|
+
stats = _context.sent;
|
|
5808
|
+
if (stats.video) {
|
|
5809
|
+
_stats$video = stats.video, framesDecoded = _stats$video.framesDecoded, bytesReceived = _stats$video.bytesReceived;
|
|
5810
|
+
if (!bytesReceived) {
|
|
5811
|
+
_this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
|
|
5812
|
+
message: "rts receive empty"
|
|
5813
|
+
}));
|
|
5814
|
+
} else if (!framesDecoded) {
|
|
5815
|
+
_this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
|
|
5816
|
+
message: "rts decode error"
|
|
5817
|
+
}));
|
|
5818
|
+
}
|
|
5819
|
+
}
|
|
5820
|
+
case 4:
|
|
5821
|
+
case "end":
|
|
5822
|
+
return _context.stop();
|
|
5823
|
+
}
|
|
5824
|
+
}, _callee);
|
|
5825
|
+
})), _this._opts.checkStatsErrorDelay);
|
|
5826
|
+
case 1:
|
|
5827
|
+
case "end":
|
|
5828
|
+
return _context2.stop();
|
|
5829
|
+
}
|
|
5830
|
+
}, _callee2);
|
|
5831
|
+
})));
|
|
5156
5832
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onTrack", function(e) {
|
|
5157
5833
|
logger.log("addTrack: ", e.track, e.streams);
|
|
5158
5834
|
_this["_".concat(e.track.kind)] = e.track;
|
|
@@ -5184,6 +5860,30 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5184
5860
|
});
|
|
5185
5861
|
});
|
|
5186
5862
|
});
|
|
5863
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
|
|
5864
|
+
if (delayHint) {
|
|
5865
|
+
try {
|
|
5866
|
+
var videoReceiver = _this._videoTransceicer.receiver;
|
|
5867
|
+
var audioReceiver = _this._audioTransceicer.receiver;
|
|
5868
|
+
if ("playoutDelayHint" in videoReceiver && "playoutDelayHint" in audioReceiver) {
|
|
5869
|
+
_this._audioTransceicer.receiver.playoutDelayHint = delayHint;
|
|
5870
|
+
_this._videoTransceicer.receiver.playoutDelayHint = delayHint;
|
|
5871
|
+
return;
|
|
5872
|
+
}
|
|
5873
|
+
if ("jitterBufferDelayHint" in videoReceiver && "jitterBufferDelayHint" in audioReceiver) {
|
|
5874
|
+
_this._audioTransceicer.receiver.jitterBufferDelayHint = delayHint;
|
|
5875
|
+
_this._videoTransceicer.receiver.jitterBufferDelayHint = delayHint;
|
|
5876
|
+
return;
|
|
5877
|
+
}
|
|
5878
|
+
if ("jitterBufferTarget" in videoReceiver && "jitterBufferTarget" in audioReceiver) {
|
|
5879
|
+
_this._audioTransceicer.receiver.jitterBufferTarget = delayHint * 1e3;
|
|
5880
|
+
_this._videoTransceicer.receiver.jitterBufferTarget = delayHint * 1e3;
|
|
5881
|
+
}
|
|
5882
|
+
} catch (error) {
|
|
5883
|
+
logger.error("set delay error");
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
});
|
|
5187
5887
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onLoaderRetry", function(error, retryTime) {
|
|
5188
5888
|
_this.emit(EVENT.LOAD_RETRY, {
|
|
5189
5889
|
error: StreamingError.network(error),
|
|
@@ -5208,7 +5908,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5208
5908
|
}
|
|
5209
5909
|
return _this;
|
|
5210
5910
|
}
|
|
5211
|
-
_createClass$
|
|
5911
|
+
_createClass$3(Rts2, [{
|
|
5212
5912
|
key: "pc",
|
|
5213
5913
|
get: function get() {
|
|
5214
5914
|
return this._pc;
|
|
@@ -5249,12 +5949,12 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5249
5949
|
}, {
|
|
5250
5950
|
key: "load",
|
|
5251
5951
|
value: function() {
|
|
5252
|
-
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
5952
|
+
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3(url) {
|
|
5253
5953
|
var _this2 = this;
|
|
5254
|
-
var lastPc;
|
|
5255
|
-
return _regeneratorRuntime$1().wrap(function
|
|
5954
|
+
var lastPc, encodedTransformSupported;
|
|
5955
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
5256
5956
|
while (1)
|
|
5257
|
-
switch (
|
|
5957
|
+
switch (_context3.prev = _context3.next) {
|
|
5258
5958
|
case 0:
|
|
5259
5959
|
this._disconnect();
|
|
5260
5960
|
this._url = url;
|
|
@@ -5263,25 +5963,28 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5263
5963
|
if (lastPc) {
|
|
5264
5964
|
lastPc.close();
|
|
5265
5965
|
}
|
|
5266
|
-
|
|
5267
|
-
|
|
5966
|
+
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
5967
|
+
_context3.prev = 6;
|
|
5968
|
+
this._pc = new RTCPeerConnection({
|
|
5969
|
+
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
5970
|
+
});
|
|
5268
5971
|
this._bindRTCEvents();
|
|
5269
|
-
|
|
5972
|
+
_context3.next = 11;
|
|
5270
5973
|
return this._connect(url);
|
|
5271
|
-
case
|
|
5272
|
-
|
|
5974
|
+
case 11:
|
|
5975
|
+
_context3.next = 16;
|
|
5273
5976
|
break;
|
|
5274
|
-
case
|
|
5275
|
-
|
|
5276
|
-
|
|
5977
|
+
case 13:
|
|
5978
|
+
_context3.prev = 13;
|
|
5979
|
+
_context3.t0 = _context3["catch"](6);
|
|
5277
5980
|
setTimeout(function() {
|
|
5278
|
-
return _this2._emitError(StreamingError.create(ERR.OTHER, null,
|
|
5981
|
+
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
|
|
5279
5982
|
});
|
|
5280
|
-
case
|
|
5983
|
+
case 16:
|
|
5281
5984
|
case "end":
|
|
5282
|
-
return
|
|
5985
|
+
return _context3.stop();
|
|
5283
5986
|
}
|
|
5284
|
-
},
|
|
5987
|
+
}, _callee3, this, [[6, 13]]);
|
|
5285
5988
|
}));
|
|
5286
5989
|
function load(_x) {
|
|
5287
5990
|
return _load.apply(this, arguments);
|
|
@@ -5323,6 +6026,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5323
6026
|
responseUrl: _this3._url,
|
|
5324
6027
|
elapsed: Date.now() - _this3._rctConnectStartTs
|
|
5325
6028
|
});
|
|
6029
|
+
_this3._checkStatsError();
|
|
5326
6030
|
}
|
|
5327
6031
|
});
|
|
5328
6032
|
}
|
|
@@ -5360,6 +6064,54 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5360
6064
|
}
|
|
5361
6065
|
}
|
|
5362
6066
|
}
|
|
6067
|
+
}, {
|
|
6068
|
+
key: "initVideoEncodedTransform",
|
|
6069
|
+
value: function initVideoEncodedTransform() {
|
|
6070
|
+
var _this5 = this;
|
|
6071
|
+
if (!this._videoTransceicer || !this._videoTransceicer.receiver) {
|
|
6072
|
+
console.log("no receiver found when trying to bind encodedTransform");
|
|
6073
|
+
return;
|
|
6074
|
+
}
|
|
6075
|
+
var receiver = this._videoTransceicer.receiver;
|
|
6076
|
+
if (isLegacyEncodedTransformSupported()) {
|
|
6077
|
+
var _receiver$createEncod = receiver.createEncodedStreams(), readable = _receiver$createEncod.readable, writable = _receiver$createEncod.writable;
|
|
6078
|
+
readable.pipeThrough(receiveSEITransform(function(sei) {
|
|
6079
|
+
_this5.emit(EVENT.SEI, sei);
|
|
6080
|
+
})).pipeTo(writable);
|
|
6081
|
+
} else if (isEncodedTransformSupported()) {
|
|
6082
|
+
var worker = new WorkerWrapper();
|
|
6083
|
+
var channel = new MessageChannel();
|
|
6084
|
+
this._videoTransceicer.receiver.transform = new RTCRtpScriptTransform(worker, {
|
|
6085
|
+
port: channel.port2
|
|
6086
|
+
}, [channel.port2]);
|
|
6087
|
+
channel.port1.onmessage = function(e) {
|
|
6088
|
+
_this5.emit(EVENT.SEI, e.data);
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
}
|
|
6092
|
+
}, {
|
|
6093
|
+
key: "initAudioEncodedTransform",
|
|
6094
|
+
value: function initAudioEncodedTransform() {
|
|
6095
|
+
if (!this._audioTransceicer || !this._audioTransceicer.receiver) {
|
|
6096
|
+
logger.warn("no receiver found when trying to bind encodedTransform");
|
|
6097
|
+
return;
|
|
6098
|
+
}
|
|
6099
|
+
if (!isLegacyEncodedTransformSupported()) {
|
|
6100
|
+
logger.warn("legacy EncodedTransform is not supported");
|
|
6101
|
+
return;
|
|
6102
|
+
}
|
|
6103
|
+
var receiver = this._audioTransceicer.receiver;
|
|
6104
|
+
var _receiver$createEncod2 = receiver.createEncodedStreams(), readable = _receiver$createEncod2.readable, writable = _receiver$createEncod2.writable;
|
|
6105
|
+
readable.pipeThrough(new TransformStream({
|
|
6106
|
+
transform: function transform(chunk, controller) {
|
|
6107
|
+
if (chunk.data.byteLength <= 1e3) {
|
|
6108
|
+
controller.enqueue(chunk);
|
|
6109
|
+
} else {
|
|
6110
|
+
logger.log("too large audio frame", chunk.data.byteLength);
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
})).pipeTo(writable);
|
|
6114
|
+
}
|
|
5363
6115
|
}, {
|
|
5364
6116
|
key: "_bindMediaEvent",
|
|
5365
6117
|
value: function _bindMediaEvent() {
|
|
@@ -5369,15 +6121,15 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5369
6121
|
}, {
|
|
5370
6122
|
key: "_connect",
|
|
5371
6123
|
value: function() {
|
|
5372
|
-
var _connect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
5373
|
-
var pc, offer,
|
|
5374
|
-
return _regeneratorRuntime$1().wrap(function
|
|
6124
|
+
var _connect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee4() {
|
|
6125
|
+
var pc, offer, parsed, finnalUrl, _this$_opts, _answer$remoteSdp, _this$_opts2, _answer$remoteSdp2, _parsed$media, parseSession, sessionId, reqStart, res, answer, err, _parsed;
|
|
6126
|
+
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
5375
6127
|
while (1)
|
|
5376
|
-
switch (
|
|
6128
|
+
switch (_context4.prev = _context4.next) {
|
|
5377
6129
|
case 0:
|
|
5378
6130
|
pc = this._pc;
|
|
5379
6131
|
if (!pc.addTransceiver) {
|
|
5380
|
-
|
|
6132
|
+
_context4.next = 11;
|
|
5381
6133
|
break;
|
|
5382
6134
|
}
|
|
5383
6135
|
this._audioTransceicer = pc.addTransceiver("audio", {
|
|
@@ -5386,28 +6138,26 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5386
6138
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
5387
6139
|
direction: "recvonly"
|
|
5388
6140
|
});
|
|
5389
|
-
|
|
5390
|
-
if (
|
|
5391
|
-
this.
|
|
5392
|
-
this.
|
|
5393
|
-
this._videoTransceicer.receiver.playoutDelayHint = delayHint;
|
|
5394
|
-
this._videoTransceicer.receiver.jitterBufferDelayHint = delayHint;
|
|
6141
|
+
this._setDelay(this._opts.delayHint);
|
|
6142
|
+
if (this._opts.enableSei) {
|
|
6143
|
+
this.initVideoEncodedTransform();
|
|
6144
|
+
this.initAudioEncodedTransform();
|
|
5395
6145
|
}
|
|
5396
|
-
|
|
6146
|
+
_context4.next = 8;
|
|
5397
6147
|
return pc.createOffer();
|
|
5398
6148
|
case 8:
|
|
5399
|
-
offer =
|
|
5400
|
-
|
|
6149
|
+
offer = _context4.sent;
|
|
6150
|
+
_context4.next = 14;
|
|
5401
6151
|
break;
|
|
5402
6152
|
case 11:
|
|
5403
|
-
|
|
6153
|
+
_context4.next = 13;
|
|
5404
6154
|
return pc.createOffer({
|
|
5405
6155
|
iceRestart: true,
|
|
5406
6156
|
offerToReceiveAudio: true,
|
|
5407
6157
|
offerToReceiveVideo: true
|
|
5408
6158
|
});
|
|
5409
6159
|
case 13:
|
|
5410
|
-
offer =
|
|
6160
|
+
offer = _context4.sent;
|
|
5411
6161
|
case 14:
|
|
5412
6162
|
logger.log("local offer");
|
|
5413
6163
|
logger.log(offer.sdp);
|
|
@@ -5433,11 +6183,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5433
6183
|
});
|
|
5434
6184
|
offer.sdp = lib.write(parsed);
|
|
5435
6185
|
logger.log("local offer modified:\n", offer.sdp);
|
|
5436
|
-
|
|
6186
|
+
_context4.next = 22;
|
|
5437
6187
|
return pc.setLocalDescription(offer);
|
|
5438
6188
|
case 22:
|
|
5439
6189
|
finnalUrl = this._url;
|
|
5440
|
-
|
|
6190
|
+
_context4.prev = 23;
|
|
5441
6191
|
if (this._opts.preProcessUrl) {
|
|
5442
6192
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
5443
6193
|
}
|
|
@@ -5450,7 +6200,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5450
6200
|
sessionId
|
|
5451
6201
|
});
|
|
5452
6202
|
reqStart = Date.now();
|
|
5453
|
-
|
|
6203
|
+
_context4.next = 32;
|
|
5454
6204
|
return this._loader.load(finnalUrl, {
|
|
5455
6205
|
body: JSON.stringify({
|
|
5456
6206
|
sessionId,
|
|
@@ -5459,22 +6209,22 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5459
6209
|
})
|
|
5460
6210
|
});
|
|
5461
6211
|
case 32:
|
|
5462
|
-
res =
|
|
6212
|
+
res = _context4.sent;
|
|
5463
6213
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
5464
6214
|
headers: res.response.headers
|
|
5465
6215
|
});
|
|
5466
6216
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
5467
6217
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
5468
|
-
|
|
6218
|
+
_context4.next = 40;
|
|
5469
6219
|
break;
|
|
5470
6220
|
}
|
|
5471
6221
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
5472
6222
|
err.errorType = ERR.NETWORK;
|
|
5473
6223
|
this._emitError(err);
|
|
5474
|
-
return
|
|
6224
|
+
return _context4.abrupt("return");
|
|
5475
6225
|
case 40:
|
|
5476
6226
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
5477
|
-
|
|
6227
|
+
_context4.next = 42;
|
|
5478
6228
|
break;
|
|
5479
6229
|
}
|
|
5480
6230
|
throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
|
|
@@ -5500,21 +6250,21 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5500
6250
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
5501
6251
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
5502
6252
|
this._rctConnectStartTs = Date.now();
|
|
5503
|
-
|
|
6253
|
+
_context4.next = 52;
|
|
5504
6254
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
5505
6255
|
case 52:
|
|
5506
6256
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
5507
|
-
|
|
6257
|
+
_context4.next = 58;
|
|
5508
6258
|
break;
|
|
5509
6259
|
case 55:
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
this._emitError(StreamingError.network(
|
|
6260
|
+
_context4.prev = 55;
|
|
6261
|
+
_context4.t0 = _context4["catch"](23);
|
|
6262
|
+
this._emitError(StreamingError.network(_context4.t0));
|
|
5513
6263
|
case 58:
|
|
5514
6264
|
case "end":
|
|
5515
|
-
return
|
|
6265
|
+
return _context4.stop();
|
|
5516
6266
|
}
|
|
5517
|
-
},
|
|
6267
|
+
}, _callee4, this, [[23, 55]]);
|
|
5518
6268
|
}));
|
|
5519
6269
|
function _connect() {
|
|
5520
6270
|
return _connect2.apply(this, arguments);
|
|
@@ -5536,6 +6286,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5536
6286
|
key: "_emitError",
|
|
5537
6287
|
value: function _emitError(error) {
|
|
5538
6288
|
this.emit(EVENT.ERROR, error);
|
|
6289
|
+
clearTimeout(this._checkStatsErrorTimer);
|
|
6290
|
+
if (this._pc) {
|
|
6291
|
+
this._pc.close();
|
|
6292
|
+
}
|
|
5539
6293
|
}
|
|
5540
6294
|
}, {
|
|
5541
6295
|
key: "destroy",
|
|
@@ -5552,6 +6306,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5552
6306
|
this._loader = null;
|
|
5553
6307
|
this._media = null;
|
|
5554
6308
|
this._pc = null;
|
|
6309
|
+
this._opts = null;
|
|
5555
6310
|
}
|
|
5556
6311
|
}], [{
|
|
5557
6312
|
key: "enableLogger",
|
|
@@ -5574,70 +6329,12 @@ try {
|
|
|
5574
6329
|
}
|
|
5575
6330
|
} catch (error) {
|
|
5576
6331
|
}
|
|
5577
|
-
function isSupported() {
|
|
5578
|
-
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
5579
|
-
return false;
|
|
5580
|
-
}
|
|
5581
|
-
return true;
|
|
5582
|
-
}
|
|
5583
|
-
function getCapacity() {
|
|
5584
|
-
if (!isSupported())
|
|
5585
|
-
return Promise.reject("RTCPeerConnection no support");
|
|
5586
|
-
var pc;
|
|
5587
|
-
try {
|
|
5588
|
-
pc = new RTCPeerConnection();
|
|
5589
|
-
pc.addTransceiver("video", {
|
|
5590
|
-
direction: "recvonly"
|
|
5591
|
-
});
|
|
5592
|
-
pc.addTransceiver("audio", {
|
|
5593
|
-
direction: "recvonly"
|
|
5594
|
-
});
|
|
5595
|
-
} catch (e) {
|
|
5596
|
-
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
5597
|
-
}
|
|
5598
|
-
return pc.createOffer().then(function(offer) {
|
|
5599
|
-
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
5600
|
-
logger.log(offer.sdp);
|
|
5601
|
-
var sdpJson = lib.parse(offer.sdp);
|
|
5602
|
-
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x) {
|
|
5603
|
-
return x.type === "video";
|
|
5604
|
-
})[0];
|
|
5605
|
-
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x) {
|
|
5606
|
-
return x.type === "audio";
|
|
5607
|
-
})[0];
|
|
5608
|
-
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x) {
|
|
5609
|
-
return x.codec === "VP8" || x.codec === "VP9" || x.codec === "H264";
|
|
5610
|
-
});
|
|
5611
|
-
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x) {
|
|
5612
|
-
return x.codec === "opus";
|
|
5613
|
-
});
|
|
5614
|
-
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
5615
|
-
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
5616
|
-
vFmtp && vCodecs.map(function(codec) {
|
|
5617
|
-
var _vFmtp$filter$;
|
|
5618
|
-
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x) {
|
|
5619
|
-
return x.payload === codec.payload;
|
|
5620
|
-
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
5621
|
-
});
|
|
5622
|
-
aFmtp && aCodecs.map(function(codec) {
|
|
5623
|
-
var _aFmtp$filter$;
|
|
5624
|
-
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x) {
|
|
5625
|
-
return x.payload === codec.payload;
|
|
5626
|
-
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
5627
|
-
});
|
|
5628
|
-
pc.close();
|
|
5629
|
-
return {
|
|
5630
|
-
video: vCodecs,
|
|
5631
|
-
audio: aCodecs
|
|
5632
|
-
};
|
|
5633
|
-
});
|
|
5634
|
-
}
|
|
5635
6332
|
var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
5636
6333
|
_inherits$1(RtsPlugin2, _BasePlugin);
|
|
5637
6334
|
var _super = _createSuper$1(RtsPlugin2);
|
|
5638
6335
|
function RtsPlugin2() {
|
|
5639
6336
|
var _this;
|
|
5640
|
-
_classCallCheck$
|
|
6337
|
+
_classCallCheck$3(this, RtsPlugin2);
|
|
5641
6338
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5642
6339
|
args[_key] = arguments[_key];
|
|
5643
6340
|
}
|
|
@@ -5702,7 +6399,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5702
6399
|
});
|
|
5703
6400
|
return _this;
|
|
5704
6401
|
}
|
|
5705
|
-
_createClass$
|
|
6402
|
+
_createClass$3(RtsPlugin2, [{
|
|
5706
6403
|
key: "pc",
|
|
5707
6404
|
get: function get() {
|
|
5708
6405
|
var _this$_rts4;
|
|
@@ -5734,7 +6431,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5734
6431
|
}, {
|
|
5735
6432
|
key: "version",
|
|
5736
6433
|
get: function get() {
|
|
5737
|
-
return "0.2.1-alpha.
|
|
6434
|
+
return "0.2.1-alpha.24";
|
|
5738
6435
|
}
|
|
5739
6436
|
}, {
|
|
5740
6437
|
key: "beforePlayerInit",
|
|
@@ -5829,6 +6526,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5829
6526
|
this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS);
|
|
5830
6527
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
5831
6528
|
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
6529
|
+
this._transCoreEvent(EVENT.SEI);
|
|
5832
6530
|
this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
|
|
5833
6531
|
}
|
|
5834
6532
|
}, {
|