@byteplus/veplayer-plugin 2.4.2-rc.1 → 2.4.2-rc.3
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 +895 -321
- package/esm/index.production.js +4 -4
- package/esm/veplayer.plugin.rtm.development.js +751 -177
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.rtm.development.js +751 -177
- package/umd/veplayer.plugin.rtm.production.js +1 -1
package/esm/index.development.js
CHANGED
|
@@ -342,13 +342,13 @@ function _regeneratorRuntime$a() {
|
|
|
342
342
|
}
|
|
343
343
|
}, exports;
|
|
344
344
|
}
|
|
345
|
-
function _typeof$
|
|
345
|
+
function _typeof$a(obj) {
|
|
346
346
|
"@babel/helpers - typeof";
|
|
347
|
-
return _typeof$
|
|
347
|
+
return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
348
348
|
return typeof obj2;
|
|
349
349
|
} : function(obj2) {
|
|
350
350
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
351
|
-
}, _typeof$
|
|
351
|
+
}, _typeof$a(obj);
|
|
352
352
|
}
|
|
353
353
|
function asyncGeneratorStep$a(gen, resolve3, reject3, _next, _throw, key2, arg) {
|
|
354
354
|
try {
|
|
@@ -527,13 +527,13 @@ function _objectSpread2$9(target) {
|
|
|
527
527
|
}
|
|
528
528
|
return target;
|
|
529
529
|
}
|
|
530
|
-
function _typeof$
|
|
530
|
+
function _typeof$9(obj) {
|
|
531
531
|
"@babel/helpers - typeof";
|
|
532
|
-
return _typeof$
|
|
532
|
+
return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
533
533
|
return typeof obj2;
|
|
534
534
|
} : function(obj2) {
|
|
535
535
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
536
|
-
}, _typeof$
|
|
536
|
+
}, _typeof$9(obj);
|
|
537
537
|
}
|
|
538
538
|
function _classCallCheck$i(instance, Constructor2) {
|
|
539
539
|
if (!(instance instanceof Constructor2)) {
|
|
@@ -574,38 +574,38 @@ function _defineProperty$g(obj, key2, value2) {
|
|
|
574
574
|
}
|
|
575
575
|
return obj;
|
|
576
576
|
}
|
|
577
|
-
function _toConsumableArray$
|
|
578
|
-
return _arrayWithoutHoles$
|
|
577
|
+
function _toConsumableArray$a(arr) {
|
|
578
|
+
return _arrayWithoutHoles$a(arr) || _iterableToArray$a(arr) || _unsupportedIterableToArray$e(arr) || _nonIterableSpread$a();
|
|
579
579
|
}
|
|
580
|
-
function _arrayWithoutHoles$
|
|
580
|
+
function _arrayWithoutHoles$a(arr) {
|
|
581
581
|
if (Array.isArray(arr))
|
|
582
|
-
return _arrayLikeToArray$
|
|
582
|
+
return _arrayLikeToArray$e(arr);
|
|
583
583
|
}
|
|
584
|
-
function _iterableToArray$
|
|
584
|
+
function _iterableToArray$a(iter) {
|
|
585
585
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
586
586
|
return Array.from(iter);
|
|
587
587
|
}
|
|
588
|
-
function _unsupportedIterableToArray$
|
|
588
|
+
function _unsupportedIterableToArray$e(o, minLen) {
|
|
589
589
|
if (!o)
|
|
590
590
|
return;
|
|
591
591
|
if (typeof o === "string")
|
|
592
|
-
return _arrayLikeToArray$
|
|
592
|
+
return _arrayLikeToArray$e(o, minLen);
|
|
593
593
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
594
594
|
if (n === "Object" && o.constructor)
|
|
595
595
|
n = o.constructor.name;
|
|
596
596
|
if (n === "Map" || n === "Set")
|
|
597
597
|
return Array.from(o);
|
|
598
598
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
599
|
-
return _arrayLikeToArray$
|
|
599
|
+
return _arrayLikeToArray$e(o, minLen);
|
|
600
600
|
}
|
|
601
|
-
function _arrayLikeToArray$
|
|
601
|
+
function _arrayLikeToArray$e(arr, len) {
|
|
602
602
|
if (len == null || len > arr.length)
|
|
603
603
|
len = arr.length;
|
|
604
604
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
605
605
|
arr2[i] = arr[i];
|
|
606
606
|
return arr2;
|
|
607
607
|
}
|
|
608
|
-
function _nonIterableSpread$
|
|
608
|
+
function _nonIterableSpread$a() {
|
|
609
609
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
610
610
|
}
|
|
611
611
|
function _toPrimitive$8(input, hint) {
|
|
@@ -922,7 +922,7 @@ util$2.hasClass = function(el, className) {
|
|
|
922
922
|
return item === className;
|
|
923
923
|
});
|
|
924
924
|
} catch (e) {
|
|
925
|
-
var orgClassName = el.className && _typeof$
|
|
925
|
+
var orgClassName = el.className && _typeof$9(el.className) === "object" ? el.getAttribute("class") : el.className;
|
|
926
926
|
return orgClassName && !!orgClassName.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
|
|
927
927
|
}
|
|
928
928
|
};
|
|
@@ -936,7 +936,7 @@ util$2.addClass = function(el, className) {
|
|
|
936
936
|
});
|
|
937
937
|
} catch (e) {
|
|
938
938
|
if (!util$2.hasClass(el, className)) {
|
|
939
|
-
if (el.className && _typeof$
|
|
939
|
+
if (el.className && _typeof$9(el.className) === "object") {
|
|
940
940
|
el.setAttribute("class", el.getAttribute("class") + " " + className);
|
|
941
941
|
} else {
|
|
942
942
|
el.className += " " + className;
|
|
@@ -956,7 +956,7 @@ util$2.removeClass = function(el, className) {
|
|
|
956
956
|
if (util$2.hasClass(el, className)) {
|
|
957
957
|
className.split(/\s+/g).forEach(function(item) {
|
|
958
958
|
var reg = new RegExp("(\\s|^)" + item + "(\\s|$)");
|
|
959
|
-
if (el.className && _typeof$
|
|
959
|
+
if (el.className && _typeof$9(el.className) === "object") {
|
|
960
960
|
el.setAttribute("class", el.getAttribute("class").replace(reg, " "));
|
|
961
961
|
} else {
|
|
962
962
|
el.className = el.className.replace(reg, " ");
|
|
@@ -1070,7 +1070,7 @@ util$2.deepMerge = function(dst, src) {
|
|
|
1070
1070
|
if (util$2.typeOf(src[key2]) === "Array" && util$2.typeOf(dst[key2]) === "Array") {
|
|
1071
1071
|
if (util$2.typeOf(dst[key2]) === "Array") {
|
|
1072
1072
|
var _dst$key;
|
|
1073
|
-
(_dst$key = dst[key2]).push.apply(_dst$key, _toConsumableArray$
|
|
1073
|
+
(_dst$key = dst[key2]).push.apply(_dst$key, _toConsumableArray$a(src[key2]));
|
|
1074
1074
|
}
|
|
1075
1075
|
} else if (util$2.typeOf(dst[key2]) === util$2.typeOf(src[key2]) && dst[key2] !== null && util$2.typeOf(dst[key2]) === "Object" && !(src[key2] instanceof window.Node)) {
|
|
1076
1076
|
util$2.deepMerge(dst[key2], src[key2]);
|
|
@@ -1197,7 +1197,7 @@ util$2.checkIsFunction = function(fun) {
|
|
|
1197
1197
|
return fun && typeof fun === "function";
|
|
1198
1198
|
};
|
|
1199
1199
|
util$2.checkIsObject = function(obj) {
|
|
1200
|
-
return obj !== null && _typeof$
|
|
1200
|
+
return obj !== null && _typeof$9(obj) === "object";
|
|
1201
1201
|
};
|
|
1202
1202
|
util$2.hide = function(dom) {
|
|
1203
1203
|
dom.style.display = "none";
|
|
@@ -1818,7 +1818,7 @@ function hook(hookName, handler) {
|
|
|
1818
1818
|
if (preRet.then) {
|
|
1819
1819
|
preRet.then(function(isContinue) {
|
|
1820
1820
|
if (isContinue !== false) {
|
|
1821
|
-
callHandler.apply(void 0, [_this, handler, preset.next].concat(_toConsumableArray$
|
|
1821
|
+
callHandler.apply(void 0, [_this, handler, preset.next].concat(_toConsumableArray$a(_arguments)));
|
|
1822
1822
|
}
|
|
1823
1823
|
}).catch(function(e) {
|
|
1824
1824
|
throw e;
|
|
@@ -2465,13 +2465,13 @@ function _regeneratorRuntime$9() {
|
|
|
2465
2465
|
}
|
|
2466
2466
|
}, exports;
|
|
2467
2467
|
}
|
|
2468
|
-
function _typeof$
|
|
2468
|
+
function _typeof$8(obj) {
|
|
2469
2469
|
"@babel/helpers - typeof";
|
|
2470
|
-
return _typeof$
|
|
2470
|
+
return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
2471
2471
|
return typeof obj2;
|
|
2472
2472
|
} : function(obj2) {
|
|
2473
2473
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
2474
|
-
}, _typeof$
|
|
2474
|
+
}, _typeof$8(obj);
|
|
2475
2475
|
}
|
|
2476
2476
|
function asyncGeneratorStep$9(gen, resolve3, reject3, _next, _throw, key2, arg) {
|
|
2477
2477
|
try {
|
|
@@ -2717,30 +2717,30 @@ function _get$4() {
|
|
|
2717
2717
|
}
|
|
2718
2718
|
return _get$4.apply(this, arguments);
|
|
2719
2719
|
}
|
|
2720
|
-
function _unsupportedIterableToArray$
|
|
2720
|
+
function _unsupportedIterableToArray$d(o, minLen) {
|
|
2721
2721
|
if (!o)
|
|
2722
2722
|
return;
|
|
2723
2723
|
if (typeof o === "string")
|
|
2724
|
-
return _arrayLikeToArray$
|
|
2724
|
+
return _arrayLikeToArray$d(o, minLen);
|
|
2725
2725
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2726
2726
|
if (n === "Object" && o.constructor)
|
|
2727
2727
|
n = o.constructor.name;
|
|
2728
2728
|
if (n === "Map" || n === "Set")
|
|
2729
2729
|
return Array.from(o);
|
|
2730
2730
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
2731
|
-
return _arrayLikeToArray$
|
|
2731
|
+
return _arrayLikeToArray$d(o, minLen);
|
|
2732
2732
|
}
|
|
2733
|
-
function _arrayLikeToArray$
|
|
2733
|
+
function _arrayLikeToArray$d(arr, len) {
|
|
2734
2734
|
if (len == null || len > arr.length)
|
|
2735
2735
|
len = arr.length;
|
|
2736
2736
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
2737
2737
|
arr2[i] = arr[i];
|
|
2738
2738
|
return arr2;
|
|
2739
2739
|
}
|
|
2740
|
-
function _createForOfIteratorHelper$
|
|
2740
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) {
|
|
2741
2741
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
2742
2742
|
if (!it) {
|
|
2743
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
|
2743
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$d(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
2744
2744
|
if (it)
|
|
2745
2745
|
o = it;
|
|
2746
2746
|
var i = 0;
|
|
@@ -3187,7 +3187,7 @@ function nowTime$7() {
|
|
|
3187
3187
|
return (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3188
3188
|
}
|
|
3189
3189
|
function reduceDepth$2(val) {
|
|
3190
|
-
if (_typeof$
|
|
3190
|
+
if (_typeof$8(val) !== "object") {
|
|
3191
3191
|
return val;
|
|
3192
3192
|
}
|
|
3193
3193
|
var objType = Object.prototype.toString.call(val).slice(8, -1);
|
|
@@ -3208,7 +3208,7 @@ function logable$2(obj, maxDepth, depth) {
|
|
|
3208
3208
|
if (!maxDepth)
|
|
3209
3209
|
maxDepth = 2;
|
|
3210
3210
|
var result = {};
|
|
3211
|
-
if (!obj || _typeof$
|
|
3211
|
+
if (!obj || _typeof$8(obj) !== "object") {
|
|
3212
3212
|
return obj;
|
|
3213
3213
|
}
|
|
3214
3214
|
var objType = Object.prototype.toString.call(obj).slice(8, -1);
|
|
@@ -3222,7 +3222,7 @@ function logable$2(obj, maxDepth, depth) {
|
|
|
3222
3222
|
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
3223
3223
|
if (depth === maxDepth) {
|
|
3224
3224
|
result[key2] = reduceDepth$2(obj[key2]);
|
|
3225
|
-
} else if (_typeof$
|
|
3225
|
+
} else if (_typeof$8(obj[key2]) === "object") {
|
|
3226
3226
|
result[key2] = logable$2(obj[key2], maxDepth, depth + 1);
|
|
3227
3227
|
} else {
|
|
3228
3228
|
result[key2] = obj[key2];
|
|
@@ -3862,7 +3862,7 @@ var MSE$3 = /* @__PURE__ */ function() {
|
|
|
3862
3862
|
} catch (error) {
|
|
3863
3863
|
if (error && error.message && error.message.indexOf("SourceBuffer is full") >= 0) {
|
|
3864
3864
|
this._mseFullFlag[type] = true;
|
|
3865
|
-
if (op.context && _typeof$
|
|
3865
|
+
if (op.context && _typeof$8(op.context) === "object") {
|
|
3866
3866
|
op.context.isFull = true;
|
|
3867
3867
|
}
|
|
3868
3868
|
this._logger.error("[MSE error], context,", op.context, " ,name,", op.opName, ",err,SourceBuffer is full");
|
|
@@ -3964,7 +3964,7 @@ var NetError$3 = /* @__PURE__ */ function(_Error) {
|
|
|
3964
3964
|
}(/* @__PURE__ */ _wrapNativeSuper$4(Error));
|
|
3965
3965
|
var toString$z = Object.prototype.toString;
|
|
3966
3966
|
function isObject$N(a) {
|
|
3967
|
-
return a !== null && _typeof$
|
|
3967
|
+
return a !== null && _typeof$8(a) === "object";
|
|
3968
3968
|
}
|
|
3969
3969
|
function isPlainObject$3(val) {
|
|
3970
3970
|
if (toString$z.call(val) !== "[object Object]") {
|
|
@@ -4829,7 +4829,7 @@ var XhrLoader$3 = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4829
4829
|
value: function _getHeaders(xhr) {
|
|
4830
4830
|
var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
|
|
4831
4831
|
var headers = {};
|
|
4832
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4832
|
+
var _iterator = _createForOfIteratorHelper$4(headerLines), _step;
|
|
4833
4833
|
try {
|
|
4834
4834
|
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4835
4835
|
var header = _step.value;
|
|
@@ -5486,7 +5486,7 @@ var MediaStatsService$1 = /* @__PURE__ */ function() {
|
|
|
5486
5486
|
}]);
|
|
5487
5487
|
return MediaStatsService2;
|
|
5488
5488
|
}();
|
|
5489
|
-
function _iterableToArrayLimit$
|
|
5489
|
+
function _iterableToArrayLimit$7(arr, i) {
|
|
5490
5490
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5491
5491
|
if (null != _i) {
|
|
5492
5492
|
var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
|
|
@@ -5623,48 +5623,48 @@ function _createSuper$c(Derived) {
|
|
|
5623
5623
|
return _possibleConstructorReturn$d(this, result);
|
|
5624
5624
|
};
|
|
5625
5625
|
}
|
|
5626
|
-
function _slicedToArray$
|
|
5627
|
-
return _arrayWithHoles$
|
|
5626
|
+
function _slicedToArray$7(arr, i) {
|
|
5627
|
+
return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$c(arr, i) || _nonIterableRest$7();
|
|
5628
5628
|
}
|
|
5629
|
-
function _toConsumableArray$
|
|
5630
|
-
return _arrayWithoutHoles$
|
|
5629
|
+
function _toConsumableArray$9(arr) {
|
|
5630
|
+
return _arrayWithoutHoles$9(arr) || _iterableToArray$9(arr) || _unsupportedIterableToArray$c(arr) || _nonIterableSpread$9();
|
|
5631
5631
|
}
|
|
5632
|
-
function _arrayWithoutHoles$
|
|
5632
|
+
function _arrayWithoutHoles$9(arr) {
|
|
5633
5633
|
if (Array.isArray(arr))
|
|
5634
|
-
return _arrayLikeToArray$
|
|
5634
|
+
return _arrayLikeToArray$c(arr);
|
|
5635
5635
|
}
|
|
5636
|
-
function _arrayWithHoles$
|
|
5636
|
+
function _arrayWithHoles$7(arr) {
|
|
5637
5637
|
if (Array.isArray(arr))
|
|
5638
5638
|
return arr;
|
|
5639
5639
|
}
|
|
5640
|
-
function _iterableToArray$
|
|
5640
|
+
function _iterableToArray$9(iter) {
|
|
5641
5641
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
5642
5642
|
return Array.from(iter);
|
|
5643
5643
|
}
|
|
5644
|
-
function _unsupportedIterableToArray$
|
|
5644
|
+
function _unsupportedIterableToArray$c(o, minLen) {
|
|
5645
5645
|
if (!o)
|
|
5646
5646
|
return;
|
|
5647
5647
|
if (typeof o === "string")
|
|
5648
|
-
return _arrayLikeToArray$
|
|
5648
|
+
return _arrayLikeToArray$c(o, minLen);
|
|
5649
5649
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5650
5650
|
if (n === "Object" && o.constructor)
|
|
5651
5651
|
n = o.constructor.name;
|
|
5652
5652
|
if (n === "Map" || n === "Set")
|
|
5653
5653
|
return Array.from(o);
|
|
5654
5654
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
5655
|
-
return _arrayLikeToArray$
|
|
5655
|
+
return _arrayLikeToArray$c(o, minLen);
|
|
5656
5656
|
}
|
|
5657
|
-
function _arrayLikeToArray$
|
|
5657
|
+
function _arrayLikeToArray$c(arr, len) {
|
|
5658
5658
|
if (len == null || len > arr.length)
|
|
5659
5659
|
len = arr.length;
|
|
5660
5660
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
5661
5661
|
arr2[i] = arr[i];
|
|
5662
5662
|
return arr2;
|
|
5663
5663
|
}
|
|
5664
|
-
function _nonIterableSpread$
|
|
5664
|
+
function _nonIterableSpread$9() {
|
|
5665
5665
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5666
5666
|
}
|
|
5667
|
-
function _nonIterableRest$
|
|
5667
|
+
function _nonIterableRest$7() {
|
|
5668
5668
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5669
5669
|
}
|
|
5670
5670
|
function _toPrimitive$6(input, hint) {
|
|
@@ -7877,11 +7877,11 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
7877
7877
|
};
|
|
7878
7878
|
}
|
|
7879
7879
|
var pssh = this.pssh(tracks[0].pssh);
|
|
7880
|
-
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale), MP42.mvex(tracks)].concat(_toConsumableArray$
|
|
7880
|
+
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale), MP42.mvex(tracks)].concat(_toConsumableArray$9(tracks.map(function(t) {
|
|
7881
7881
|
return MP42.trak(t);
|
|
7882
7882
|
})), [pssh]));
|
|
7883
7883
|
} else {
|
|
7884
|
-
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale)].concat(_toConsumableArray$
|
|
7884
|
+
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale)].concat(_toConsumableArray$9(tracks.map(function(t) {
|
|
7885
7885
|
return MP42.trak(t);
|
|
7886
7886
|
})), [MP42.mvex(tracks)]));
|
|
7887
7887
|
}
|
|
@@ -8318,7 +8318,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8318
8318
|
224 | 1,
|
|
8319
8319
|
sps.length >>> 8 & 255,
|
|
8320
8320
|
sps.length & 255
|
|
8321
|
-
]).concat.apply(_ref, _toConsumableArray$
|
|
8321
|
+
]).concat.apply(_ref, _toConsumableArray$9(sps)).concat([1, pps.length >>> 8 & 255, pps.length & 255])).concat.apply(_concat$concat, _toConsumableArray$9(pps)));
|
|
8322
8322
|
var btrt = new Uint8Array([0, 0, 88, 57, 0, 15, 200, 192, 0, 4, 86, 72]);
|
|
8323
8323
|
var sinf = MP42.sinf(track.encv);
|
|
8324
8324
|
var pasp = new Uint8Array([
|
|
@@ -8481,13 +8481,13 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8481
8481
|
len = s.byteLength;
|
|
8482
8482
|
sps.push(len >>> 8 & 255);
|
|
8483
8483
|
sps.push(len & 255);
|
|
8484
|
-
sps.push.apply(sps, _toConsumableArray$
|
|
8484
|
+
sps.push.apply(sps, _toConsumableArray$9(s));
|
|
8485
8485
|
});
|
|
8486
8486
|
track.pps.forEach(function(p) {
|
|
8487
8487
|
len = p.byteLength;
|
|
8488
8488
|
pps.push(len >>> 8 & 255);
|
|
8489
8489
|
pps.push(len & 255);
|
|
8490
|
-
pps.push.apply(pps, _toConsumableArray$
|
|
8490
|
+
pps.push.apply(pps, _toConsumableArray$9(p));
|
|
8491
8491
|
});
|
|
8492
8492
|
return MP42.box(MP42.types.avcC, new Uint8Array((_concat$concat2 = (_ref2 = [
|
|
8493
8493
|
1,
|
|
@@ -8538,7 +8538,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8538
8538
|
var write = function write2(x2) {
|
|
8539
8539
|
var _data;
|
|
8540
8540
|
data2.push(x2.length >> 8, x2.length);
|
|
8541
|
-
(_data = data2).push.apply(_data, _toConsumableArray$
|
|
8541
|
+
(_data = data2).push.apply(_data, _toConsumableArray$9(x2));
|
|
8542
8542
|
};
|
|
8543
8543
|
if (vps.length) {
|
|
8544
8544
|
data2.push(160, 0, vps.length);
|
|
@@ -8675,7 +8675,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8675
8675
|
}, {
|
|
8676
8676
|
key: "pasp",
|
|
8677
8677
|
value: function pasp(_ref3) {
|
|
8678
|
-
var _ref4 = _slicedToArray$
|
|
8678
|
+
var _ref4 = _slicedToArray$7(_ref3, 2), hSpacing = _ref4[0], vSpacing = _ref4[1];
|
|
8679
8679
|
return MP42.box(MP42.types.pasp, new Uint8Array([hSpacing >> 24, hSpacing >> 16 & 255, hSpacing >> 8 & 255, hSpacing & 255, vSpacing >> 24, vSpacing >> 16 & 255, vSpacing >> 8 & 255, vSpacing & 255]));
|
|
8680
8680
|
}
|
|
8681
8681
|
}, {
|
|
@@ -8750,7 +8750,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8750
8750
|
}, {
|
|
8751
8751
|
key: "mvex",
|
|
8752
8752
|
value: function mvex(tracks) {
|
|
8753
|
-
var mvex2 = MP42.box.apply(MP42, [MP42.types.mvex].concat(_toConsumableArray$
|
|
8753
|
+
var mvex2 = MP42.box.apply(MP42, [MP42.types.mvex].concat(_toConsumableArray$9(tracks.map(function(t) {
|
|
8754
8754
|
return MP42.trex(t.id);
|
|
8755
8755
|
}))));
|
|
8756
8756
|
return mvex2;
|
|
@@ -8851,7 +8851,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
8851
8851
|
}, {
|
|
8852
8852
|
key: "moof",
|
|
8853
8853
|
value: function moof(tracks) {
|
|
8854
|
-
var moof2 = MP42.box.apply(MP42, [MP42.types.moof, MP42.mfhd(tracks[0].samples ? tracks[0].samples[0].gopId : 0)].concat(_toConsumableArray$
|
|
8854
|
+
var moof2 = MP42.box.apply(MP42, [MP42.types.moof, MP42.mfhd(tracks[0].samples ? tracks[0].samples[0].gopId : 0)].concat(_toConsumableArray$9(tracks.map(function(t) {
|
|
8855
8855
|
return MP42.traf(t);
|
|
8856
8856
|
}))));
|
|
8857
8857
|
return moof2;
|
|
@@ -9150,7 +9150,7 @@ var MP4$4 = /* @__PURE__ */ function() {
|
|
|
9150
9150
|
}, {
|
|
9151
9151
|
key: "moovMP4",
|
|
9152
9152
|
value: function moovMP4(tracks) {
|
|
9153
|
-
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].duration, tracks[0].timescale)].concat(_toConsumableArray$
|
|
9153
|
+
return MP42.box.apply(MP42, [MP42.types.moov, MP42.mvhd(tracks[0].duration, tracks[0].timescale)].concat(_toConsumableArray$9(tracks.map(function(t) {
|
|
9154
9154
|
return MP42.trackMP4(t);
|
|
9155
9155
|
}))));
|
|
9156
9156
|
}
|
|
@@ -12819,7 +12819,7 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
12819
12819
|
if (_this.flv) {
|
|
12820
12820
|
var _this$player$config, _this$player$config$f;
|
|
12821
12821
|
_this.player.config.url = url;
|
|
12822
|
-
if (_typeof$
|
|
12822
|
+
if (_typeof$a(seamless) === "object") {
|
|
12823
12823
|
seamless = seamless.seamless;
|
|
12824
12824
|
}
|
|
12825
12825
|
_this.flv.switchURL(url, seamless);
|
|
@@ -13016,13 +13016,13 @@ function _toPropertyKey$5(t) {
|
|
|
13016
13016
|
var i = _toPrimitive$5(t, "string");
|
|
13017
13017
|
return "symbol" == typeof i ? i : String(i);
|
|
13018
13018
|
}
|
|
13019
|
-
function _typeof$
|
|
13019
|
+
function _typeof$7(o) {
|
|
13020
13020
|
"@babel/helpers - typeof";
|
|
13021
|
-
return _typeof$
|
|
13021
|
+
return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
13022
13022
|
return typeof o2;
|
|
13023
13023
|
} : function(o2) {
|
|
13024
13024
|
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
13025
|
-
}, _typeof$
|
|
13025
|
+
}, _typeof$7(o);
|
|
13026
13026
|
}
|
|
13027
13027
|
function _classCallCheck$f(instance, Constructor2) {
|
|
13028
13028
|
if (!(instance instanceof Constructor2)) {
|
|
@@ -13389,7 +13389,7 @@ var abrAlgo = function() {
|
|
|
13389
13389
|
} else {
|
|
13390
13390
|
scriptDirectory = "";
|
|
13391
13391
|
}
|
|
13392
|
-
if (!((typeof window === "undefined" ? "undefined" : _typeof$
|
|
13392
|
+
if (!((typeof window === "undefined" ? "undefined" : _typeof$7(window)) === "object" || typeof importScripts === "function"))
|
|
13393
13393
|
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
13394
13394
|
}
|
|
13395
13395
|
var out = Module["print"] || console.log.bind(console);
|
|
@@ -24120,7 +24120,7 @@ var abrAlgo = function() {
|
|
|
24120
24120
|
RuntimeError: Error
|
|
24121
24121
|
};
|
|
24122
24122
|
wasmBinary = [];
|
|
24123
|
-
if (_typeof$
|
|
24123
|
+
if (_typeof$7(WebAssembly2) !== "object") {
|
|
24124
24124
|
abort("no native wasm support detected");
|
|
24125
24125
|
}
|
|
24126
24126
|
var wasmMemory;
|
|
@@ -25930,7 +25930,7 @@ var Algo = /* @__PURE__ */ function() {
|
|
|
25930
25930
|
}, {
|
|
25931
25931
|
key: "updateDeviceInfo",
|
|
25932
25932
|
value: function updateDeviceInfo() {
|
|
25933
|
-
var devicePixelRatio = (typeof window === "undefined" ? "undefined" : _typeof$
|
|
25933
|
+
var devicePixelRatio = (typeof window === "undefined" ? "undefined" : _typeof$7(window)) === "object" ? window.devicePixelRatio || 1 : 1;
|
|
25934
25934
|
var _this$player$video$ge = this.player.video.getBoundingClientRect(), width = _this$player$video$ge.width, height = _this$player$video$ge.height;
|
|
25935
25935
|
this.module._updateDeviceInfo(Math.floor(width), Math.floor(height), devicePixelRatio, 30);
|
|
25936
25936
|
}
|
|
@@ -26828,6 +26828,32 @@ var index$5 = /* @__PURE__ */ Object.freeze({
|
|
|
26828
26828
|
FlvPlugin,
|
|
26829
26829
|
__PLUGIN_NAME__: __PLUGIN_NAME__$5
|
|
26830
26830
|
});
|
|
26831
|
+
function _iterableToArrayLimit$6(arr, i) {
|
|
26832
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
26833
|
+
if (null != _i) {
|
|
26834
|
+
var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
|
|
26835
|
+
try {
|
|
26836
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
26837
|
+
if (Object(_i) !== _i)
|
|
26838
|
+
return;
|
|
26839
|
+
_n = false;
|
|
26840
|
+
} else
|
|
26841
|
+
for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true)
|
|
26842
|
+
;
|
|
26843
|
+
} catch (err) {
|
|
26844
|
+
_d = true, _e = err;
|
|
26845
|
+
} finally {
|
|
26846
|
+
try {
|
|
26847
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r))
|
|
26848
|
+
return;
|
|
26849
|
+
} finally {
|
|
26850
|
+
if (_d)
|
|
26851
|
+
throw _e;
|
|
26852
|
+
}
|
|
26853
|
+
}
|
|
26854
|
+
return _arr;
|
|
26855
|
+
}
|
|
26856
|
+
}
|
|
26831
26857
|
function ownKeys$b(object, enumerableOnly) {
|
|
26832
26858
|
var keys9 = Object.keys(object);
|
|
26833
26859
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -27165,14 +27191,6 @@ function _regeneratorRuntime$8() {
|
|
|
27165
27191
|
}
|
|
27166
27192
|
}, exports;
|
|
27167
27193
|
}
|
|
27168
|
-
function _typeof$7(obj) {
|
|
27169
|
-
"@babel/helpers - typeof";
|
|
27170
|
-
return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
27171
|
-
return typeof obj2;
|
|
27172
|
-
} : function(obj2) {
|
|
27173
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
27174
|
-
}, _typeof$7(obj);
|
|
27175
|
-
}
|
|
27176
27194
|
function asyncGeneratorStep$8(gen, resolve3, reject3, _next, _throw, key2, arg) {
|
|
27177
27195
|
try {
|
|
27178
27196
|
var info = gen[key2](arg);
|
|
@@ -27313,6 +27331,104 @@ function _createSuper$b(Derived) {
|
|
|
27313
27331
|
return _possibleConstructorReturn$b(this, result);
|
|
27314
27332
|
};
|
|
27315
27333
|
}
|
|
27334
|
+
function _slicedToArray$6(arr, i) {
|
|
27335
|
+
return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$b(arr, i) || _nonIterableRest$6();
|
|
27336
|
+
}
|
|
27337
|
+
function _toConsumableArray$8(arr) {
|
|
27338
|
+
return _arrayWithoutHoles$8(arr) || _iterableToArray$8(arr) || _unsupportedIterableToArray$b(arr) || _nonIterableSpread$8();
|
|
27339
|
+
}
|
|
27340
|
+
function _arrayWithoutHoles$8(arr) {
|
|
27341
|
+
if (Array.isArray(arr))
|
|
27342
|
+
return _arrayLikeToArray$b(arr);
|
|
27343
|
+
}
|
|
27344
|
+
function _arrayWithHoles$6(arr) {
|
|
27345
|
+
if (Array.isArray(arr))
|
|
27346
|
+
return arr;
|
|
27347
|
+
}
|
|
27348
|
+
function _iterableToArray$8(iter) {
|
|
27349
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
27350
|
+
return Array.from(iter);
|
|
27351
|
+
}
|
|
27352
|
+
function _unsupportedIterableToArray$b(o, minLen) {
|
|
27353
|
+
if (!o)
|
|
27354
|
+
return;
|
|
27355
|
+
if (typeof o === "string")
|
|
27356
|
+
return _arrayLikeToArray$b(o, minLen);
|
|
27357
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
27358
|
+
if (n === "Object" && o.constructor)
|
|
27359
|
+
n = o.constructor.name;
|
|
27360
|
+
if (n === "Map" || n === "Set")
|
|
27361
|
+
return Array.from(o);
|
|
27362
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
27363
|
+
return _arrayLikeToArray$b(o, minLen);
|
|
27364
|
+
}
|
|
27365
|
+
function _arrayLikeToArray$b(arr, len) {
|
|
27366
|
+
if (len == null || len > arr.length)
|
|
27367
|
+
len = arr.length;
|
|
27368
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
27369
|
+
arr2[i] = arr[i];
|
|
27370
|
+
return arr2;
|
|
27371
|
+
}
|
|
27372
|
+
function _nonIterableSpread$8() {
|
|
27373
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27374
|
+
}
|
|
27375
|
+
function _nonIterableRest$6() {
|
|
27376
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27377
|
+
}
|
|
27378
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) {
|
|
27379
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
27380
|
+
if (!it) {
|
|
27381
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$b(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
27382
|
+
if (it)
|
|
27383
|
+
o = it;
|
|
27384
|
+
var i = 0;
|
|
27385
|
+
var F = function() {
|
|
27386
|
+
};
|
|
27387
|
+
return {
|
|
27388
|
+
s: F,
|
|
27389
|
+
n: function() {
|
|
27390
|
+
if (i >= o.length)
|
|
27391
|
+
return {
|
|
27392
|
+
done: true
|
|
27393
|
+
};
|
|
27394
|
+
return {
|
|
27395
|
+
done: false,
|
|
27396
|
+
value: o[i++]
|
|
27397
|
+
};
|
|
27398
|
+
},
|
|
27399
|
+
e: function(e) {
|
|
27400
|
+
throw e;
|
|
27401
|
+
},
|
|
27402
|
+
f: F
|
|
27403
|
+
};
|
|
27404
|
+
}
|
|
27405
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27406
|
+
}
|
|
27407
|
+
var normalCompletion = true, didErr = false, err;
|
|
27408
|
+
return {
|
|
27409
|
+
s: function() {
|
|
27410
|
+
it = it.call(o);
|
|
27411
|
+
},
|
|
27412
|
+
n: function() {
|
|
27413
|
+
var step = it.next();
|
|
27414
|
+
normalCompletion = step.done;
|
|
27415
|
+
return step;
|
|
27416
|
+
},
|
|
27417
|
+
e: function(e) {
|
|
27418
|
+
didErr = true;
|
|
27419
|
+
err = e;
|
|
27420
|
+
},
|
|
27421
|
+
f: function() {
|
|
27422
|
+
try {
|
|
27423
|
+
if (!normalCompletion && it.return != null)
|
|
27424
|
+
it.return();
|
|
27425
|
+
} finally {
|
|
27426
|
+
if (didErr)
|
|
27427
|
+
throw err;
|
|
27428
|
+
}
|
|
27429
|
+
}
|
|
27430
|
+
};
|
|
27431
|
+
}
|
|
27316
27432
|
function _toPrimitive$4(input, hint) {
|
|
27317
27433
|
if (typeof input !== "object" || input === null)
|
|
27318
27434
|
return input;
|
|
@@ -30434,87 +30550,595 @@ var NetworkEvaluate = /* @__PURE__ */ function() {
|
|
|
30434
30550
|
}]);
|
|
30435
30551
|
return NetworkEvaluate2;
|
|
30436
30552
|
}();
|
|
30437
|
-
var
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30443
|
-
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
|
|
30447
|
-
|
|
30448
|
-
|
|
30449
|
-
|
|
30450
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_lastMediaStream", null);
|
|
30451
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_media", null);
|
|
30452
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_opts", null);
|
|
30453
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_loader", null);
|
|
30454
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_networkEvaluate", null);
|
|
30455
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_retry", 0);
|
|
30456
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_waitingTimer", 0);
|
|
30457
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_rctConnectStartTs", 0);
|
|
30458
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_isReplacing", false);
|
|
30459
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_onTrack", function(e) {
|
|
30460
|
-
logger$6.log("addTrack: ", e.track, e.streams);
|
|
30461
|
-
_this["_".concat(e.track.kind)] = e.track;
|
|
30462
|
-
});
|
|
30463
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_mockWaitingByTimeupdate", function() {
|
|
30464
|
-
var _this$_pc, _this$_pc2;
|
|
30465
|
-
if (!(((_this$_pc = _this._pc) === null || _this$_pc === void 0 ? void 0 : _this$_pc.connectionState) === "connected" || ((_this$_pc2 = _this._pc) === null || _this$_pc2 === void 0 ? void 0 : _this$_pc2.iceConnectionState) === "connected"))
|
|
30466
|
-
return;
|
|
30467
|
-
clearTimeout(_this._waitingTimer);
|
|
30468
|
-
_this._waitingTimer = setTimeout(function() {
|
|
30469
|
-
var _this$_media;
|
|
30470
|
-
if ((_this$_media = _this._media) !== null && _this$_media !== void 0 && _this$_media.paused)
|
|
30471
|
-
return;
|
|
30472
|
-
_this.emit("waiting");
|
|
30473
|
-
}, _this._opts.stallInterval);
|
|
30474
|
-
});
|
|
30475
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_onLoadedData", function() {
|
|
30476
|
-
logger$6.log("loadeddata emit");
|
|
30477
|
-
_this.getStatsSnapshoot().then(function(snap) {
|
|
30478
|
-
_this.emit(EVENT$2.METADATA_PARSED, {
|
|
30479
|
-
type: "video",
|
|
30480
|
-
elapsed: Date.now() - _this._rctConnectStartTs,
|
|
30481
|
-
meta: snap.video
|
|
30482
|
-
});
|
|
30483
|
-
_this.emit(EVENT$2.METADATA_PARSED, {
|
|
30484
|
-
type: "audio",
|
|
30485
|
-
elapsed: Date.now() - _this._rctConnectStartTs,
|
|
30486
|
-
meta: snap.audio
|
|
30487
|
-
});
|
|
30488
|
-
});
|
|
30489
|
-
});
|
|
30490
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_onLoaderRetry", function(error, retryTime) {
|
|
30491
|
-
_this.emit(EVENT$2.LOAD_RETRY, {
|
|
30492
|
-
error: StreamingError$2.network(error),
|
|
30493
|
-
retryTime
|
|
30494
|
-
});
|
|
30495
|
-
});
|
|
30496
|
-
_this._opts = getOption(opts);
|
|
30497
|
-
_this._media = _this._opts.media;
|
|
30498
|
-
_this._loader = new NetLoader$2(_objectSpread2$7(_objectSpread2$7({}, opts.fetchOptions), {}, {
|
|
30499
|
-
responseType: "json",
|
|
30500
|
-
method: "POST",
|
|
30501
|
-
retry: _this._opts.retryCount,
|
|
30502
|
-
retryDelay: _this._opts.retryDelay,
|
|
30503
|
-
timeout: _this._opts.loadTimeout,
|
|
30504
|
-
onRetryError: _this._onLoaderRetry,
|
|
30505
|
-
logger: logger$6
|
|
30506
|
-
}));
|
|
30507
|
-
_this._retry = _this._opts.retryCount;
|
|
30508
|
-
_this._bindMediaEvent();
|
|
30509
|
-
if (_this._opts.mediaStream && _this._opts.seamlesslyReload) {
|
|
30510
|
-
_this._lastMediaStream = _this._opts.mediaStream;
|
|
30553
|
+
var RTC_SEI_TYPE = /* @__PURE__ */ function(RTC_SEI_TYPE2) {
|
|
30554
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["internal"] = 0] = "internal";
|
|
30555
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["external"] = 1] = "external";
|
|
30556
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["bypass"] = 2] = "bypass";
|
|
30557
|
+
return RTC_SEI_TYPE2;
|
|
30558
|
+
}(RTC_SEI_TYPE || {});
|
|
30559
|
+
var UUID_INTERNAL = new Uint8Array([109, 167, 53, 190, 103, 90, 72, 1, 170, 89, 63, 164, 194, 199, 19, 85]);
|
|
30560
|
+
var UUID_EXTERNAL = new Uint8Array([109, 167, 53, 190, 103, 90, 72, 1, 170, 89, 63, 164, 194, 199, 19, 84]);
|
|
30561
|
+
var rbsp2ebsp = function rbsp2ebsp2(src) {
|
|
30562
|
+
var result = [];
|
|
30563
|
+
for (var i = 0; i < src.length; i++) {
|
|
30564
|
+
if (src[i] <= 3 && src[i - 1] === 0 && src[i - 2] === 0) {
|
|
30565
|
+
result.push(3);
|
|
30511
30566
|
}
|
|
30512
|
-
|
|
30567
|
+
result.push(src[i]);
|
|
30513
30568
|
}
|
|
30514
|
-
|
|
30515
|
-
|
|
30516
|
-
|
|
30517
|
-
|
|
30569
|
+
return new Uint8Array(result);
|
|
30570
|
+
};
|
|
30571
|
+
var ebsp2rbsp = function ebsp2rbsp2(src) {
|
|
30572
|
+
var result = [];
|
|
30573
|
+
for (var i = 0; i < src.length; i++) {
|
|
30574
|
+
if (src[i] <= 3 && src[i - 1] === 0 && src[i - 2] === 0) {
|
|
30575
|
+
continue;
|
|
30576
|
+
}
|
|
30577
|
+
result.push(src[i]);
|
|
30578
|
+
}
|
|
30579
|
+
return new Uint8Array(result);
|
|
30580
|
+
};
|
|
30581
|
+
function serializeData(num) {
|
|
30582
|
+
var result = [];
|
|
30583
|
+
while (num >= 255) {
|
|
30584
|
+
num -= 255;
|
|
30585
|
+
result.push(255);
|
|
30586
|
+
}
|
|
30587
|
+
result.push(num);
|
|
30588
|
+
return new Uint8Array(result);
|
|
30589
|
+
}
|
|
30590
|
+
function deserializeData(data2) {
|
|
30591
|
+
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
30592
|
+
var result = 0;
|
|
30593
|
+
while (data2[offset] === 255 && offset < data2.byteLength) {
|
|
30594
|
+
offset++;
|
|
30595
|
+
result += 255;
|
|
30596
|
+
}
|
|
30597
|
+
if (offset < data2.byteLength) {
|
|
30598
|
+
result += data2[offset++];
|
|
30599
|
+
}
|
|
30600
|
+
return [result, offset];
|
|
30601
|
+
}
|
|
30602
|
+
var SEIHelper = /* @__PURE__ */ function() {
|
|
30603
|
+
function SEIHelper2() {
|
|
30604
|
+
_classCallCheck$e(this, SEIHelper2);
|
|
30605
|
+
}
|
|
30606
|
+
_createClass$e(SEIHelper2, null, [{
|
|
30607
|
+
key: "generateSEI",
|
|
30608
|
+
value: function generateSEI(src) {
|
|
30609
|
+
var internal = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
30610
|
+
var annexbHeader = new Uint8Array([0, 0, 0, 1]);
|
|
30611
|
+
var nalType = new Uint8Array([6]);
|
|
30612
|
+
var seiType = new Uint8Array([5]);
|
|
30613
|
+
var uuid = internal ? UUID_INTERNAL : UUID_EXTERNAL;
|
|
30614
|
+
var serializedPayloadSize = serializeData(src.byteLength + uuid.byteLength);
|
|
30615
|
+
var payloadEbsp = rbsp2ebsp(src);
|
|
30616
|
+
return new Uint8Array([].concat(_toConsumableArray$8(annexbHeader), _toConsumableArray$8(nalType), _toConsumableArray$8(seiType), _toConsumableArray$8(serializedPayloadSize), _toConsumableArray$8(uuid), _toConsumableArray$8(payloadEbsp), [128]));
|
|
30617
|
+
}
|
|
30618
|
+
}, {
|
|
30619
|
+
key: "decodeSeiBody",
|
|
30620
|
+
value: function decodeSeiBody(src) {
|
|
30621
|
+
src = src.slice(0, src.length - 1);
|
|
30622
|
+
var rbsp = ebsp2rbsp(src);
|
|
30623
|
+
if (rbsp.byteLength < 2) {
|
|
30624
|
+
return;
|
|
30625
|
+
}
|
|
30626
|
+
var offset = 0;
|
|
30627
|
+
if (!(rbsp[1] === 5 || rbsp[1] === 100)) {
|
|
30628
|
+
return;
|
|
30629
|
+
}
|
|
30630
|
+
offset += 2;
|
|
30631
|
+
var _deserializeData = deserializeData(rbsp, offset), _deserializeData2 = _slicedToArray$6(_deserializeData, 2), payloadLength = _deserializeData2[0], newOffset = _deserializeData2[1];
|
|
30632
|
+
offset = newOffset;
|
|
30633
|
+
var rtcSeiType = 2;
|
|
30634
|
+
var end = offset + payloadLength;
|
|
30635
|
+
if (rbsp.byteLength >= UUID_EXTERNAL.byteLength && payloadLength >= UUID_EXTERNAL.byteLength && rbsp.slice(offset, offset + UUID_EXTERNAL.byteLength).toString() === UUID_EXTERNAL.toString()) {
|
|
30636
|
+
offset += UUID_EXTERNAL.byteLength;
|
|
30637
|
+
rtcSeiType = 1;
|
|
30638
|
+
} else if (rbsp.byteLength >= UUID_EXTERNAL.byteLength && payloadLength >= UUID_EXTERNAL.byteLength && rbsp.slice(offset, offset + UUID_INTERNAL.byteLength).toString() === UUID_INTERNAL.toString()) {
|
|
30639
|
+
offset += UUID_INTERNAL.byteLength;
|
|
30640
|
+
rtcSeiType = 0;
|
|
30641
|
+
}
|
|
30642
|
+
var seiPayload = rbsp.slice(offset, end);
|
|
30643
|
+
return {
|
|
30644
|
+
type: rtcSeiType,
|
|
30645
|
+
payload: seiPayload
|
|
30646
|
+
};
|
|
30647
|
+
}
|
|
30648
|
+
}, {
|
|
30649
|
+
key: "parseInternalSEI",
|
|
30650
|
+
value: function parseInternalSEI(decodedSEI) {
|
|
30651
|
+
var result = /* @__PURE__ */ new Map();
|
|
30652
|
+
var offset = 0;
|
|
30653
|
+
if (decodedSEI.type === 0) {
|
|
30654
|
+
while (decodedSEI.payload.byteLength - offset >= 2) {
|
|
30655
|
+
var _deserializeData3 = deserializeData(decodedSEI.payload, offset), _deserializeData4 = _slicedToArray$6(_deserializeData3, 2), internalSeiType = _deserializeData4[0], newOffset = _deserializeData4[1];
|
|
30656
|
+
offset = newOffset;
|
|
30657
|
+
var _deserializeData5 = deserializeData(decodedSEI.payload, offset), _deserializeData6 = _slicedToArray$6(_deserializeData5, 2), internalSeiLength = _deserializeData6[0], newOff = _deserializeData6[1];
|
|
30658
|
+
offset = newOff;
|
|
30659
|
+
if (!result.get(internalSeiType) && internalSeiLength <= decodedSEI.payload.byteLength - offset) {
|
|
30660
|
+
result.set(internalSeiType, decodedSEI.payload.slice(offset, offset + internalSeiLength));
|
|
30661
|
+
offset += internalSeiLength;
|
|
30662
|
+
} else {
|
|
30663
|
+
break;
|
|
30664
|
+
}
|
|
30665
|
+
}
|
|
30666
|
+
return result;
|
|
30667
|
+
}
|
|
30668
|
+
}
|
|
30669
|
+
}, {
|
|
30670
|
+
key: "makeInternalSei",
|
|
30671
|
+
value: function makeInternalSei(map6) {
|
|
30672
|
+
var resultSeiList = [];
|
|
30673
|
+
var _iterator = _createForOfIteratorHelper$3(map6), _step;
|
|
30674
|
+
try {
|
|
30675
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
30676
|
+
var _step$value = _slicedToArray$6(_step.value, 2), type = _step$value[0], payload = _step$value[1];
|
|
30677
|
+
var serializedType = serializeData(type);
|
|
30678
|
+
var size = serializeData(payload.byteLength);
|
|
30679
|
+
resultSeiList.push(serializedType, size, payload);
|
|
30680
|
+
}
|
|
30681
|
+
} catch (err) {
|
|
30682
|
+
_iterator.e(err);
|
|
30683
|
+
} finally {
|
|
30684
|
+
_iterator.f();
|
|
30685
|
+
}
|
|
30686
|
+
var resultLength = resultSeiList.reduce(function(pre, cur) {
|
|
30687
|
+
return pre + cur.byteLength;
|
|
30688
|
+
}, 0);
|
|
30689
|
+
var result = new Uint8Array(resultLength);
|
|
30690
|
+
resultSeiList.reduce(function(pre, cur) {
|
|
30691
|
+
result.set(cur, pre);
|
|
30692
|
+
return pre + cur.byteLength;
|
|
30693
|
+
}, 0);
|
|
30694
|
+
return result;
|
|
30695
|
+
}
|
|
30696
|
+
}]);
|
|
30697
|
+
return SEIHelper2;
|
|
30698
|
+
}();
|
|
30699
|
+
var Nalunit = /* @__PURE__ */ function() {
|
|
30700
|
+
function Nalunit2() {
|
|
30701
|
+
_classCallCheck$e(this, Nalunit2);
|
|
30702
|
+
}
|
|
30703
|
+
_createClass$e(Nalunit2, null, [{
|
|
30704
|
+
key: "getNalunits",
|
|
30705
|
+
value: function getNalunits(buffer) {
|
|
30706
|
+
if (buffer.length - buffer.position < 4) {
|
|
30707
|
+
return [];
|
|
30708
|
+
}
|
|
30709
|
+
var position = buffer.position;
|
|
30710
|
+
if (buffer.getInt32(position) === 1 || buffer.getInt16(position) === 0 && buffer.getInt8(position + 2) === 1) {
|
|
30711
|
+
return Nalunit2.getAnnexbNals(buffer);
|
|
30712
|
+
} else {
|
|
30713
|
+
return Nalunit2.getAvccNals(buffer);
|
|
30714
|
+
}
|
|
30715
|
+
}
|
|
30716
|
+
}, {
|
|
30717
|
+
key: "getAnnexbNals",
|
|
30718
|
+
value: function getAnnexbNals(buffer) {
|
|
30719
|
+
var nals = [];
|
|
30720
|
+
var position = Nalunit2.getHeaderPositionAnnexB(buffer);
|
|
30721
|
+
var start = position.pos;
|
|
30722
|
+
var end = start;
|
|
30723
|
+
while (start < buffer.length - 4) {
|
|
30724
|
+
var header = new Uint8Array(buffer.buffer.slice(start, start + position.headerLength));
|
|
30725
|
+
if (position.pos === buffer.position) {
|
|
30726
|
+
buffer.skip(position.headerLength);
|
|
30727
|
+
}
|
|
30728
|
+
position = Nalunit2.getHeaderPositionAnnexB(buffer);
|
|
30729
|
+
end = position.pos;
|
|
30730
|
+
var body = new Uint8Array(buffer.buffer.slice(start + header.byteLength, end));
|
|
30731
|
+
var unit = {
|
|
30732
|
+
header,
|
|
30733
|
+
body,
|
|
30734
|
+
type: -1
|
|
30735
|
+
};
|
|
30736
|
+
Nalunit2.analyseNal(unit);
|
|
30737
|
+
if (unit.type <= 9 && unit.type !== 0) {
|
|
30738
|
+
nals.push(unit);
|
|
30739
|
+
}
|
|
30740
|
+
buffer.skip(end - buffer.position);
|
|
30741
|
+
start = end;
|
|
30742
|
+
}
|
|
30743
|
+
return nals;
|
|
30744
|
+
}
|
|
30745
|
+
}, {
|
|
30746
|
+
key: "getAvccNals",
|
|
30747
|
+
value: function getAvccNals(buffer) {
|
|
30748
|
+
var nals = [];
|
|
30749
|
+
while (buffer.position < buffer.length - 4) {
|
|
30750
|
+
var length = buffer.getInt32(buffer.position);
|
|
30751
|
+
if (buffer.length - buffer.position >= length) {
|
|
30752
|
+
var header = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + 4));
|
|
30753
|
+
buffer.skip(4);
|
|
30754
|
+
var body = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + length));
|
|
30755
|
+
buffer.skip(length);
|
|
30756
|
+
var unit = {
|
|
30757
|
+
header,
|
|
30758
|
+
body,
|
|
30759
|
+
type: -1
|
|
30760
|
+
};
|
|
30761
|
+
Nalunit2.analyseNal(unit);
|
|
30762
|
+
if (unit.type <= 9 && unit.type !== 0) {
|
|
30763
|
+
nals.push(unit);
|
|
30764
|
+
}
|
|
30765
|
+
} else {
|
|
30766
|
+
break;
|
|
30767
|
+
}
|
|
30768
|
+
}
|
|
30769
|
+
return nals;
|
|
30770
|
+
}
|
|
30771
|
+
}, {
|
|
30772
|
+
key: "analyseNal",
|
|
30773
|
+
value: function analyseNal(unit) {
|
|
30774
|
+
var type = unit.body[0] & 31;
|
|
30775
|
+
unit.type = type;
|
|
30776
|
+
switch (type) {
|
|
30777
|
+
case 1:
|
|
30778
|
+
unit.ndr = true;
|
|
30779
|
+
break;
|
|
30780
|
+
case 5:
|
|
30781
|
+
unit.idr = true;
|
|
30782
|
+
break;
|
|
30783
|
+
case 6:
|
|
30784
|
+
unit.sei = true;
|
|
30785
|
+
break;
|
|
30786
|
+
case 7:
|
|
30787
|
+
unit.sps = true;
|
|
30788
|
+
break;
|
|
30789
|
+
case 8:
|
|
30790
|
+
unit.pps = true;
|
|
30791
|
+
break;
|
|
30792
|
+
}
|
|
30793
|
+
}
|
|
30794
|
+
}, {
|
|
30795
|
+
key: "getHeaderPositionAnnexB",
|
|
30796
|
+
value: function getHeaderPositionAnnexB(buffer) {
|
|
30797
|
+
var pos = buffer.position;
|
|
30798
|
+
var headerLength = 0;
|
|
30799
|
+
var bufferLen = buffer.length;
|
|
30800
|
+
while (headerLength !== 3 && headerLength !== 4 && pos < bufferLen - 4) {
|
|
30801
|
+
if (buffer.getInt16(pos) === 0) {
|
|
30802
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
30803
|
+
headerLength = 4;
|
|
30804
|
+
} else if (buffer.getInt8(pos + 2) === 1) {
|
|
30805
|
+
headerLength = 3;
|
|
30806
|
+
} else {
|
|
30807
|
+
pos++;
|
|
30808
|
+
}
|
|
30809
|
+
} else {
|
|
30810
|
+
pos++;
|
|
30811
|
+
}
|
|
30812
|
+
}
|
|
30813
|
+
if (pos === bufferLen - 4) {
|
|
30814
|
+
if (buffer.getInt16(pos) === 0) {
|
|
30815
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
30816
|
+
headerLength = 4;
|
|
30817
|
+
} else {
|
|
30818
|
+
pos = bufferLen;
|
|
30819
|
+
}
|
|
30820
|
+
} else {
|
|
30821
|
+
pos++;
|
|
30822
|
+
if (buffer.getInt16(pos) === 0 && buffer.getInt8(pos) === 1) {
|
|
30823
|
+
headerLength = 3;
|
|
30824
|
+
} else {
|
|
30825
|
+
pos = bufferLen;
|
|
30826
|
+
}
|
|
30827
|
+
}
|
|
30828
|
+
}
|
|
30829
|
+
return {
|
|
30830
|
+
pos,
|
|
30831
|
+
headerLength
|
|
30832
|
+
};
|
|
30833
|
+
}
|
|
30834
|
+
}]);
|
|
30835
|
+
return Nalunit2;
|
|
30836
|
+
}();
|
|
30837
|
+
var RTCDataView = /* @__PURE__ */ function() {
|
|
30838
|
+
function RTCDataView2(buffer) {
|
|
30839
|
+
_classCallCheck$e(this, RTCDataView2);
|
|
30840
|
+
this._position = 0;
|
|
30841
|
+
this._dataview = new DataView(buffer);
|
|
30842
|
+
}
|
|
30843
|
+
_createClass$e(RTCDataView2, [{
|
|
30844
|
+
key: "length",
|
|
30845
|
+
get: function get3() {
|
|
30846
|
+
return this.buffer.byteLength;
|
|
30847
|
+
}
|
|
30848
|
+
}, {
|
|
30849
|
+
key: "buffer",
|
|
30850
|
+
get: function get3() {
|
|
30851
|
+
return this._dataview.buffer;
|
|
30852
|
+
}
|
|
30853
|
+
}, {
|
|
30854
|
+
key: "position",
|
|
30855
|
+
get: function get3() {
|
|
30856
|
+
return this._position;
|
|
30857
|
+
},
|
|
30858
|
+
set: function set5(value2) {
|
|
30859
|
+
this._position = value2;
|
|
30860
|
+
}
|
|
30861
|
+
}, {
|
|
30862
|
+
key: "back",
|
|
30863
|
+
value: function back(count) {
|
|
30864
|
+
this.position -= count;
|
|
30865
|
+
}
|
|
30866
|
+
}, {
|
|
30867
|
+
key: "getUint8",
|
|
30868
|
+
value: function getUint82(offset) {
|
|
30869
|
+
return this._dataview.getUint8(offset);
|
|
30870
|
+
}
|
|
30871
|
+
}, {
|
|
30872
|
+
key: "getInt8",
|
|
30873
|
+
value: function getInt8(offset) {
|
|
30874
|
+
return this._dataview.getInt8(offset);
|
|
30875
|
+
}
|
|
30876
|
+
}, {
|
|
30877
|
+
key: "getInt16",
|
|
30878
|
+
value: function getInt16(offset) {
|
|
30879
|
+
return this._dataview.getInt16(offset);
|
|
30880
|
+
}
|
|
30881
|
+
}, {
|
|
30882
|
+
key: "getUint16",
|
|
30883
|
+
value: function getUint16(offset) {
|
|
30884
|
+
return this._dataview.getUint16(offset);
|
|
30885
|
+
}
|
|
30886
|
+
}, {
|
|
30887
|
+
key: "getUint32",
|
|
30888
|
+
value: function getUint32(offset) {
|
|
30889
|
+
return this._dataview.getUint32(offset);
|
|
30890
|
+
}
|
|
30891
|
+
}, {
|
|
30892
|
+
key: "getInt32",
|
|
30893
|
+
value: function getInt32(offset) {
|
|
30894
|
+
return this._dataview.getInt32(offset);
|
|
30895
|
+
}
|
|
30896
|
+
}, {
|
|
30897
|
+
key: "skip",
|
|
30898
|
+
value: function skip(count) {
|
|
30899
|
+
var loop = Math.floor(count / 4);
|
|
30900
|
+
var last2 = count % 4;
|
|
30901
|
+
for (var i = 0; i < loop; i++) {
|
|
30902
|
+
RTCDataView2.readByte(this, 4);
|
|
30903
|
+
}
|
|
30904
|
+
if (last2 > 0) {
|
|
30905
|
+
RTCDataView2.readByte(this, last2);
|
|
30906
|
+
}
|
|
30907
|
+
}
|
|
30908
|
+
}, {
|
|
30909
|
+
key: "readUint8",
|
|
30910
|
+
value: function readUint8() {
|
|
30911
|
+
return RTCDataView2.readByte(this, 1);
|
|
30912
|
+
}
|
|
30913
|
+
}, {
|
|
30914
|
+
key: "readUint16",
|
|
30915
|
+
value: function readUint16() {
|
|
30916
|
+
return RTCDataView2.readByte(this, 2);
|
|
30917
|
+
}
|
|
30918
|
+
}, {
|
|
30919
|
+
key: "readUint24",
|
|
30920
|
+
value: function readUint24() {
|
|
30921
|
+
return RTCDataView2.readByte(this, 3);
|
|
30922
|
+
}
|
|
30923
|
+
}, {
|
|
30924
|
+
key: "readUint32",
|
|
30925
|
+
value: function readUint32() {
|
|
30926
|
+
return RTCDataView2.readByte(this, 4);
|
|
30927
|
+
}
|
|
30928
|
+
}, {
|
|
30929
|
+
key: "readUint64",
|
|
30930
|
+
value: function readUint64() {
|
|
30931
|
+
return RTCDataView2.readByte(this, 8);
|
|
30932
|
+
}
|
|
30933
|
+
}, {
|
|
30934
|
+
key: "readInt8",
|
|
30935
|
+
value: function readInt8() {
|
|
30936
|
+
return RTCDataView2.readByte(this, 1, true);
|
|
30937
|
+
}
|
|
30938
|
+
}, {
|
|
30939
|
+
key: "readInt16",
|
|
30940
|
+
value: function readInt16() {
|
|
30941
|
+
return RTCDataView2.readByte(this, 2, true);
|
|
30942
|
+
}
|
|
30943
|
+
}, {
|
|
30944
|
+
key: "readInt32",
|
|
30945
|
+
value: function readInt32() {
|
|
30946
|
+
return RTCDataView2.readByte(this, 4, true);
|
|
30947
|
+
}
|
|
30948
|
+
}, {
|
|
30949
|
+
key: "writeUint32",
|
|
30950
|
+
value: function writeUint32(value2) {
|
|
30951
|
+
return new Uint8Array([value2 >>> 24 & 255, value2 >>> 16 & 255, value2 >>> 8 & 255, value2 & 255]);
|
|
30952
|
+
}
|
|
30953
|
+
}], [{
|
|
30954
|
+
key: "readByte",
|
|
30955
|
+
value: function readByte(buffer, size, sign3) {
|
|
30956
|
+
var res;
|
|
30957
|
+
switch (size) {
|
|
30958
|
+
case 1:
|
|
30959
|
+
if (sign3) {
|
|
30960
|
+
res = buffer.getInt8(buffer.position);
|
|
30961
|
+
} else {
|
|
30962
|
+
res = buffer.getUint8(buffer.position);
|
|
30963
|
+
}
|
|
30964
|
+
break;
|
|
30965
|
+
case 2:
|
|
30966
|
+
if (sign3) {
|
|
30967
|
+
res = buffer.getInt16(buffer.position);
|
|
30968
|
+
} else {
|
|
30969
|
+
res = buffer.getUint16(buffer.position);
|
|
30970
|
+
}
|
|
30971
|
+
break;
|
|
30972
|
+
case 3:
|
|
30973
|
+
if (sign3) {
|
|
30974
|
+
throw new Error("not supported for readByte 3");
|
|
30975
|
+
} else {
|
|
30976
|
+
res = buffer.getUint8(buffer.position) << 16;
|
|
30977
|
+
res |= buffer.getUint8(buffer.position + 1) << 8;
|
|
30978
|
+
res |= buffer.getUint8(buffer.position + 2);
|
|
30979
|
+
}
|
|
30980
|
+
break;
|
|
30981
|
+
case 4:
|
|
30982
|
+
if (sign3) {
|
|
30983
|
+
res = buffer.getInt32(buffer.position);
|
|
30984
|
+
} else {
|
|
30985
|
+
res = buffer.getUint32(buffer.position);
|
|
30986
|
+
}
|
|
30987
|
+
break;
|
|
30988
|
+
case 8:
|
|
30989
|
+
if (sign3) {
|
|
30990
|
+
throw new Error("not supported for readBody 8");
|
|
30991
|
+
} else {
|
|
30992
|
+
res = buffer.getUint32(buffer.position) << 32;
|
|
30993
|
+
res |= buffer.getUint32(buffer.position + 4);
|
|
30994
|
+
}
|
|
30995
|
+
break;
|
|
30996
|
+
default:
|
|
30997
|
+
res = "";
|
|
30998
|
+
}
|
|
30999
|
+
buffer.position += size;
|
|
31000
|
+
return res;
|
|
31001
|
+
}
|
|
31002
|
+
}]);
|
|
31003
|
+
return RTCDataView2;
|
|
31004
|
+
}();
|
|
31005
|
+
function isSupported$1() {
|
|
31006
|
+
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
31007
|
+
return false;
|
|
31008
|
+
}
|
|
31009
|
+
return true;
|
|
31010
|
+
}
|
|
31011
|
+
function getCapacity() {
|
|
31012
|
+
if (!isSupported$1())
|
|
31013
|
+
return Promise.reject("RTCPeerConnection no support");
|
|
31014
|
+
var pc;
|
|
31015
|
+
try {
|
|
31016
|
+
pc = new RTCPeerConnection();
|
|
31017
|
+
pc.addTransceiver("video", {
|
|
31018
|
+
direction: "recvonly"
|
|
31019
|
+
});
|
|
31020
|
+
pc.addTransceiver("audio", {
|
|
31021
|
+
direction: "recvonly"
|
|
31022
|
+
});
|
|
31023
|
+
} catch (e) {
|
|
31024
|
+
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
31025
|
+
}
|
|
31026
|
+
return pc.createOffer().then(function(offer) {
|
|
31027
|
+
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
31028
|
+
logger$6.log(offer.sdp);
|
|
31029
|
+
var sdpJson = lib$1.parse(offer.sdp);
|
|
31030
|
+
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x2) {
|
|
31031
|
+
return x2.type === "video";
|
|
31032
|
+
})[0];
|
|
31033
|
+
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x2) {
|
|
31034
|
+
return x2.type === "audio";
|
|
31035
|
+
})[0];
|
|
31036
|
+
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x2) {
|
|
31037
|
+
return x2.codec === "VP8" || x2.codec === "VP9" || x2.codec === "H264";
|
|
31038
|
+
});
|
|
31039
|
+
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x2) {
|
|
31040
|
+
return x2.codec === "opus";
|
|
31041
|
+
});
|
|
31042
|
+
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
31043
|
+
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
31044
|
+
vFmtp && vCodecs.map(function(codec) {
|
|
31045
|
+
var _vFmtp$filter$;
|
|
31046
|
+
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x2) {
|
|
31047
|
+
return x2.payload === codec.payload;
|
|
31048
|
+
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
31049
|
+
});
|
|
31050
|
+
aFmtp && aCodecs.map(function(codec) {
|
|
31051
|
+
var _aFmtp$filter$;
|
|
31052
|
+
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x2) {
|
|
31053
|
+
return x2.payload === codec.payload;
|
|
31054
|
+
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
31055
|
+
});
|
|
31056
|
+
pc.close();
|
|
31057
|
+
return {
|
|
31058
|
+
video: vCodecs,
|
|
31059
|
+
audio: aCodecs
|
|
31060
|
+
};
|
|
31061
|
+
});
|
|
31062
|
+
}
|
|
31063
|
+
var isEncodedTransformSupported = function isEncodedTransformSupported2() {
|
|
31064
|
+
return typeof TransformStream !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
31065
|
+
};
|
|
31066
|
+
var logger$6 = new Logger$7("rts");
|
|
31067
|
+
var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
31068
|
+
_inherits$b(Rts2, _EventEmitter);
|
|
31069
|
+
var _super = _createSuper$b(Rts2);
|
|
31070
|
+
function Rts2(opts) {
|
|
31071
|
+
var _this;
|
|
31072
|
+
_classCallCheck$e(this, Rts2);
|
|
31073
|
+
_this = _super.call(this);
|
|
31074
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_url", "");
|
|
31075
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_pc", null);
|
|
31076
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_audioTransceicer", null);
|
|
31077
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_videoTransceicer", null);
|
|
31078
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_mediaStream", null);
|
|
31079
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_media", null);
|
|
31080
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_opts", null);
|
|
31081
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_loader", null);
|
|
31082
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_networkEvaluate", null);
|
|
31083
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_retry", 0);
|
|
31084
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_waitingTimer", 0);
|
|
31085
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_rctConnectStartTs", 0);
|
|
31086
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onTrack", function(e) {
|
|
31087
|
+
logger$6.log("addTrack: ", e.track, e.streams);
|
|
31088
|
+
_this["_".concat(e.track.kind)] = e.track;
|
|
31089
|
+
});
|
|
31090
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_mockWaitingByTimeupdate", function() {
|
|
31091
|
+
var _this$_pc, _this$_pc2;
|
|
31092
|
+
if (!(((_this$_pc = _this._pc) === null || _this$_pc === void 0 ? void 0 : _this$_pc.connectionState) === "connected" || ((_this$_pc2 = _this._pc) === null || _this$_pc2 === void 0 ? void 0 : _this$_pc2.iceConnectionState) === "connected"))
|
|
31093
|
+
return;
|
|
31094
|
+
clearTimeout(_this._waitingTimer);
|
|
31095
|
+
_this._waitingTimer = setTimeout(function() {
|
|
31096
|
+
var _this$_media;
|
|
31097
|
+
if ((_this$_media = _this._media) !== null && _this$_media !== void 0 && _this$_media.paused)
|
|
31098
|
+
return;
|
|
31099
|
+
_this.emit("waiting");
|
|
31100
|
+
}, _this._opts.stallInterval);
|
|
31101
|
+
});
|
|
31102
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onLoadedData", function() {
|
|
31103
|
+
logger$6.log("loadeddata emit");
|
|
31104
|
+
_this.getStatsSnapshoot().then(function(snap) {
|
|
31105
|
+
_this.emit(EVENT$2.METADATA_PARSED, {
|
|
31106
|
+
type: "video",
|
|
31107
|
+
elapsed: Date.now() - _this._rctConnectStartTs,
|
|
31108
|
+
meta: snap.video
|
|
31109
|
+
});
|
|
31110
|
+
_this.emit(EVENT$2.METADATA_PARSED, {
|
|
31111
|
+
type: "audio",
|
|
31112
|
+
elapsed: Date.now() - _this._rctConnectStartTs,
|
|
31113
|
+
meta: snap.audio
|
|
31114
|
+
});
|
|
31115
|
+
});
|
|
31116
|
+
});
|
|
31117
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onLoaderRetry", function(error, retryTime) {
|
|
31118
|
+
_this.emit(EVENT$2.LOAD_RETRY, {
|
|
31119
|
+
error: StreamingError$2.network(error),
|
|
31120
|
+
retryTime
|
|
31121
|
+
});
|
|
31122
|
+
});
|
|
31123
|
+
_this._opts = getOption(opts);
|
|
31124
|
+
_this._media = _this._opts.media;
|
|
31125
|
+
_this._loader = new NetLoader$2(_objectSpread2$7(_objectSpread2$7({}, opts.fetchOptions), {}, {
|
|
31126
|
+
responseType: "json",
|
|
31127
|
+
method: "POST",
|
|
31128
|
+
retry: _this._opts.retryCount,
|
|
31129
|
+
retryDelay: _this._opts.retryDelay,
|
|
31130
|
+
timeout: _this._opts.loadTimeout,
|
|
31131
|
+
onRetryError: _this._onLoaderRetry,
|
|
31132
|
+
logger: logger$6
|
|
31133
|
+
}));
|
|
31134
|
+
_this._retry = _this._opts.retryCount;
|
|
31135
|
+
_this._bindMediaEvent();
|
|
31136
|
+
return _this;
|
|
31137
|
+
}
|
|
31138
|
+
_createClass$e(Rts2, [{
|
|
31139
|
+
key: "pc",
|
|
31140
|
+
get: function get3() {
|
|
31141
|
+
return this._pc;
|
|
30518
31142
|
}
|
|
30519
31143
|
}, {
|
|
30520
31144
|
key: "audioTrack",
|
|
@@ -30552,9 +31176,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30552
31176
|
}, {
|
|
30553
31177
|
key: "load",
|
|
30554
31178
|
value: function() {
|
|
30555
|
-
var _load = _asyncToGenerator$8(/* @__PURE__ */ _regeneratorRuntime$8().mark(function _callee(url
|
|
31179
|
+
var _load = _asyncToGenerator$8(/* @__PURE__ */ _regeneratorRuntime$8().mark(function _callee(url) {
|
|
30556
31180
|
var _this2 = this;
|
|
30557
|
-
var
|
|
31181
|
+
var lastPc;
|
|
30558
31182
|
return _regeneratorRuntime$8().wrap(function _callee$(_context) {
|
|
30559
31183
|
while (1)
|
|
30560
31184
|
switch (_context.prev = _context.next) {
|
|
@@ -30562,43 +31186,39 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30562
31186
|
this._disconnect();
|
|
30563
31187
|
this._url = url;
|
|
30564
31188
|
this._retry = this._opts.retryCount;
|
|
30565
|
-
|
|
30566
|
-
|
|
30567
|
-
|
|
30568
|
-
(_this$_pc3 = this._pc) === null || _this$_pc3 === void 0 ? void 0 : _this$_pc3.close();
|
|
31189
|
+
lastPc = this._pc;
|
|
31190
|
+
if (lastPc) {
|
|
31191
|
+
lastPc.close();
|
|
30569
31192
|
}
|
|
30570
|
-
_context.prev =
|
|
31193
|
+
_context.prev = 5;
|
|
30571
31194
|
this._pc = new RTCPeerConnection();
|
|
30572
31195
|
this._bindRTCEvents();
|
|
30573
|
-
_context.next =
|
|
31196
|
+
_context.next = 10;
|
|
30574
31197
|
return this._connect(url);
|
|
30575
|
-
case
|
|
30576
|
-
_context.next =
|
|
31198
|
+
case 10:
|
|
31199
|
+
_context.next = 15;
|
|
30577
31200
|
break;
|
|
30578
|
-
case
|
|
30579
|
-
_context.prev =
|
|
30580
|
-
_context.t0 = _context["catch"](
|
|
31201
|
+
case 12:
|
|
31202
|
+
_context.prev = 12;
|
|
31203
|
+
_context.t0 = _context["catch"](5);
|
|
30581
31204
|
setTimeout(function() {
|
|
30582
31205
|
return _this2._emitError(StreamingError$2.create(ERR$2.OTHER, null, _context.t0));
|
|
30583
31206
|
});
|
|
30584
|
-
case
|
|
31207
|
+
case 15:
|
|
30585
31208
|
case "end":
|
|
30586
31209
|
return _context.stop();
|
|
30587
31210
|
}
|
|
30588
|
-
}, _callee, this, [[
|
|
31211
|
+
}, _callee, this, [[5, 12]]);
|
|
30589
31212
|
}));
|
|
30590
|
-
function load(_x
|
|
31213
|
+
function load(_x) {
|
|
30591
31214
|
return _load.apply(this, arguments);
|
|
30592
31215
|
}
|
|
30593
31216
|
return load;
|
|
30594
31217
|
}()
|
|
30595
31218
|
}, {
|
|
30596
31219
|
key: "switchURL",
|
|
30597
|
-
value: function switchURL(url
|
|
30598
|
-
|
|
30599
|
-
this._lastMediaStream = this._mediaStream;
|
|
30600
|
-
}
|
|
30601
|
-
this.load(url || this._url, seamless);
|
|
31220
|
+
value: function switchURL(url) {
|
|
31221
|
+
this.load(url || this._url);
|
|
30602
31222
|
}
|
|
30603
31223
|
}, {
|
|
30604
31224
|
key: "_bindRTCEvents",
|
|
@@ -30624,7 +31244,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30624
31244
|
_this3.load(_this3._url);
|
|
30625
31245
|
}
|
|
30626
31246
|
if (pc.connectionState === "connected") {
|
|
30627
|
-
_this3._closeLastPc();
|
|
30628
31247
|
_this3._handleMediaStream();
|
|
30629
31248
|
_this3.emit(EVENT$2.TTFB, {
|
|
30630
31249
|
url: _this3._url,
|
|
@@ -30637,29 +31256,18 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30637
31256
|
}, {
|
|
30638
31257
|
key: "_handleMediaStream",
|
|
30639
31258
|
value: function _handleMediaStream() {
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
var
|
|
30643
|
-
var videoTrack = this._lastMediaStream.getVideoTracks()[0];
|
|
30644
|
-
var audioTrack = this._lastMediaStream.getAudioTracks()[0];
|
|
31259
|
+
if (this._opts.mediaStream && this._opts.seamlesslyReload) {
|
|
31260
|
+
var videoTrack = this._opts.mediaStream.getVideoTracks()[0];
|
|
31261
|
+
var audioTrack = this._opts.mediaStream.getAudioTracks()[0];
|
|
30645
31262
|
if (videoTrack) {
|
|
30646
|
-
this.
|
|
31263
|
+
this._opts.mediaStream.removeTrack(videoTrack);
|
|
30647
31264
|
}
|
|
30648
31265
|
if (audioTrack) {
|
|
30649
|
-
this.
|
|
30650
|
-
}
|
|
30651
|
-
this._mediaStream = this.
|
|
30652
|
-
this._mediaStream.addTrack(this._audio);
|
|
30653
|
-
this._mediaStream.addTrack(this._video);
|
|
30654
|
-
this._isReplacing = true;
|
|
30655
|
-
this._media.pause();
|
|
30656
|
-
(_this$_media$play = this._media.play()) === null || _this$_media$play === void 0 ? void 0 : _this$_media$play.finally(function() {
|
|
30657
|
-
_this4._isReplacing = false;
|
|
30658
|
-
});
|
|
31266
|
+
this._opts.mediaStream.removeTrack(audioTrack);
|
|
31267
|
+
}
|
|
31268
|
+
this._mediaStream = this._opts.mediaStream;
|
|
30659
31269
|
} else {
|
|
30660
31270
|
this._mediaStream = new MediaStream();
|
|
30661
|
-
this._mediaStream.addTrack(this._audio);
|
|
30662
|
-
this._mediaStream.addTrack(this._video);
|
|
30663
31271
|
this._media.srcObject = this._mediaStream;
|
|
30664
31272
|
var req = this._media.play();
|
|
30665
31273
|
if (req && req.catch) {
|
|
@@ -30667,6 +31275,39 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30667
31275
|
});
|
|
30668
31276
|
}
|
|
30669
31277
|
}
|
|
31278
|
+
this._audio && this._mediaStream.addTrack(this._audio);
|
|
31279
|
+
this._video && this._mediaStream.addTrack(this._video);
|
|
31280
|
+
}
|
|
31281
|
+
}, {
|
|
31282
|
+
key: "initVideoEncodedTransform",
|
|
31283
|
+
value: function initVideoEncodedTransform() {
|
|
31284
|
+
var _this4 = this;
|
|
31285
|
+
if (!this._videoTransceicer || !this._videoTransceicer.receiver) {
|
|
31286
|
+
console.log("no receiver found when trying to bind encodedTransform");
|
|
31287
|
+
return;
|
|
31288
|
+
}
|
|
31289
|
+
var receiver = this._videoTransceicer.receiver;
|
|
31290
|
+
if (isEncodedTransformSupported()) {
|
|
31291
|
+
var _receiver$createEncod = receiver.createEncodedStreams(), readable = _receiver$createEncod.readable, writable = _receiver$createEncod.writable;
|
|
31292
|
+
readable.pipeThrough(new TransformStream({
|
|
31293
|
+
transform: function transform(chunk, controller) {
|
|
31294
|
+
var nals = Nalunit.getNalunits(new RTCDataView(chunk.data));
|
|
31295
|
+
nals.forEach(function(nalUnit) {
|
|
31296
|
+
if (nalUnit.sei) {
|
|
31297
|
+
var decodedSei = SEIHelper.decodeSeiBody(nalUnit.body);
|
|
31298
|
+
if (decodedSei && decodedSei.type !== RTC_SEI_TYPE.internal) {
|
|
31299
|
+
_this4.emit(EVENT$2.SEI, {
|
|
31300
|
+
sei: {
|
|
31301
|
+
content: decodedSei.payload
|
|
31302
|
+
}
|
|
31303
|
+
});
|
|
31304
|
+
}
|
|
31305
|
+
}
|
|
31306
|
+
});
|
|
31307
|
+
controller.enqueue(chunk);
|
|
31308
|
+
}
|
|
31309
|
+
})).pipeTo(writable);
|
|
31310
|
+
}
|
|
30670
31311
|
}
|
|
30671
31312
|
}, {
|
|
30672
31313
|
key: "_bindMediaEvent",
|
|
@@ -30685,7 +31326,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30685
31326
|
case 0:
|
|
30686
31327
|
pc = this._pc;
|
|
30687
31328
|
if (!pc.addTransceiver) {
|
|
30688
|
-
_context2.next =
|
|
31329
|
+
_context2.next = 12;
|
|
30689
31330
|
break;
|
|
30690
31331
|
}
|
|
30691
31332
|
this._audioTransceicer = pc.addTransceiver("audio", {
|
|
@@ -30694,6 +31335,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30694
31335
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
30695
31336
|
direction: "recvonly"
|
|
30696
31337
|
});
|
|
31338
|
+
this.initVideoEncodedTransform();
|
|
30697
31339
|
delayHint = this._opts.delayHint;
|
|
30698
31340
|
if (delayHint) {
|
|
30699
31341
|
this._audioTransceicer.receiver.playoutDelayHint = delayHint;
|
|
@@ -30701,22 +31343,22 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30701
31343
|
this._videoTransceicer.receiver.playoutDelayHint = delayHint;
|
|
30702
31344
|
this._videoTransceicer.receiver.jitterBufferDelayHint = delayHint;
|
|
30703
31345
|
}
|
|
30704
|
-
_context2.next =
|
|
31346
|
+
_context2.next = 9;
|
|
30705
31347
|
return pc.createOffer();
|
|
30706
|
-
case
|
|
31348
|
+
case 9:
|
|
30707
31349
|
offer = _context2.sent;
|
|
30708
|
-
_context2.next =
|
|
31350
|
+
_context2.next = 15;
|
|
30709
31351
|
break;
|
|
30710
|
-
case
|
|
30711
|
-
_context2.next =
|
|
31352
|
+
case 12:
|
|
31353
|
+
_context2.next = 14;
|
|
30712
31354
|
return pc.createOffer({
|
|
30713
31355
|
iceRestart: true,
|
|
30714
31356
|
offerToReceiveAudio: true,
|
|
30715
31357
|
offerToReceiveVideo: true
|
|
30716
31358
|
});
|
|
30717
|
-
case 13:
|
|
30718
|
-
offer = _context2.sent;
|
|
30719
31359
|
case 14:
|
|
31360
|
+
offer = _context2.sent;
|
|
31361
|
+
case 15:
|
|
30720
31362
|
logger$6.log("local offer");
|
|
30721
31363
|
logger$6.log(offer.sdp);
|
|
30722
31364
|
parsed = lib$1.parse(offer.sdp);
|
|
@@ -30741,11 +31383,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30741
31383
|
});
|
|
30742
31384
|
offer.sdp = lib$1.write(parsed);
|
|
30743
31385
|
logger$6.log("local offer modified:\n", offer.sdp);
|
|
30744
|
-
_context2.next =
|
|
31386
|
+
_context2.next = 23;
|
|
30745
31387
|
return pc.setLocalDescription(offer);
|
|
30746
|
-
case
|
|
31388
|
+
case 23:
|
|
30747
31389
|
finnalUrl = this._url;
|
|
30748
|
-
_context2.prev =
|
|
31390
|
+
_context2.prev = 24;
|
|
30749
31391
|
if (this._opts.preProcessUrl) {
|
|
30750
31392
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
30751
31393
|
}
|
|
@@ -30758,7 +31400,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30758
31400
|
sessionId
|
|
30759
31401
|
});
|
|
30760
31402
|
reqStart = Date.now();
|
|
30761
|
-
_context2.next =
|
|
31403
|
+
_context2.next = 33;
|
|
30762
31404
|
return this._loader.load(finnalUrl, {
|
|
30763
31405
|
body: JSON.stringify({
|
|
30764
31406
|
sessionId,
|
|
@@ -30766,27 +31408,27 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30766
31408
|
localSdp: offer
|
|
30767
31409
|
})
|
|
30768
31410
|
});
|
|
30769
|
-
case
|
|
31411
|
+
case 33:
|
|
30770
31412
|
res = _context2.sent;
|
|
30771
31413
|
this.emit(EVENT$2.LOAD_RESPONSE_HEADERS, {
|
|
30772
31414
|
headers: res.response.headers
|
|
30773
31415
|
});
|
|
30774
31416
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
30775
31417
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
30776
|
-
_context2.next =
|
|
31418
|
+
_context2.next = 41;
|
|
30777
31419
|
break;
|
|
30778
31420
|
}
|
|
30779
31421
|
err = StreamingError$2.create(answer.code === 404 ? ERR$2.NETWORK_NOTFOUND : ERR$2.NETWORK_FORBIDDEN, null, answer);
|
|
30780
31422
|
err.errorType = ERR$2.NETWORK;
|
|
30781
31423
|
this._emitError(err);
|
|
30782
31424
|
return _context2.abrupt("return");
|
|
30783
|
-
case
|
|
31425
|
+
case 41:
|
|
30784
31426
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
30785
|
-
_context2.next =
|
|
31427
|
+
_context2.next = 43;
|
|
30786
31428
|
break;
|
|
30787
31429
|
}
|
|
30788
31430
|
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));
|
|
30789
|
-
case
|
|
31431
|
+
case 43:
|
|
30790
31432
|
logger$6.log("answer:");
|
|
30791
31433
|
logger$6.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
30792
31434
|
this.emit(EVENT$2.LOAD_COMPLETE, {
|
|
@@ -30801,41 +31443,35 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30801
31443
|
answer.remoteSdp.sdp = lib$1.write(_parsed);
|
|
30802
31444
|
logger$6.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
30803
31445
|
this._rctConnectStartTs = Date.now();
|
|
30804
|
-
_context2.next =
|
|
31446
|
+
_context2.next = 53;
|
|
30805
31447
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
30806
|
-
case
|
|
31448
|
+
case 53:
|
|
30807
31449
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
30808
|
-
_context2.next =
|
|
31450
|
+
_context2.next = 59;
|
|
30809
31451
|
break;
|
|
30810
|
-
case
|
|
30811
|
-
_context2.prev =
|
|
30812
|
-
_context2.t0 = _context2["catch"](
|
|
31452
|
+
case 56:
|
|
31453
|
+
_context2.prev = 56;
|
|
31454
|
+
_context2.t0 = _context2["catch"](24);
|
|
30813
31455
|
this._emitError(StreamingError$2.network(_context2.t0));
|
|
30814
|
-
case
|
|
31456
|
+
case 59:
|
|
30815
31457
|
case "end":
|
|
30816
31458
|
return _context2.stop();
|
|
30817
31459
|
}
|
|
30818
|
-
}, _callee2, this, [[
|
|
31460
|
+
}, _callee2, this, [[24, 56]]);
|
|
30819
31461
|
}));
|
|
30820
31462
|
function _connect() {
|
|
30821
31463
|
return _connect2.apply(this, arguments);
|
|
30822
31464
|
}
|
|
30823
31465
|
return _connect;
|
|
30824
31466
|
}()
|
|
30825
|
-
}, {
|
|
30826
|
-
key: "_closeLastPc",
|
|
30827
|
-
value: function _closeLastPc() {
|
|
30828
|
-
if (this._lastPc) {
|
|
30829
|
-
this._lastPc.close();
|
|
30830
|
-
this._lastPc = null;
|
|
30831
|
-
}
|
|
30832
|
-
}
|
|
30833
31467
|
}, {
|
|
30834
31468
|
key: "_disconnect",
|
|
30835
31469
|
value: function _disconnect() {
|
|
30836
|
-
var _this$_loader, _this$_networkEvaluat2;
|
|
31470
|
+
var _this$_loader, _this$_networkEvaluat2, _this$_videoTransceic, _this$_audioTransceic;
|
|
30837
31471
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
30838
31472
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
31473
|
+
(_this$_videoTransceic = this._videoTransceicer) === null || _this$_videoTransceic === void 0 ? void 0 : _this$_videoTransceic.stop();
|
|
31474
|
+
(_this$_audioTransceic = this._audioTransceicer) === null || _this$_audioTransceic === void 0 ? void 0 : _this$_audioTransceic.stop();
|
|
30839
31475
|
this._audioTransceicer = null;
|
|
30840
31476
|
this._videoTransceicer = null;
|
|
30841
31477
|
this._mediaStream = null;
|
|
@@ -30844,7 +31480,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30844
31480
|
}, {
|
|
30845
31481
|
key: "_emitError",
|
|
30846
31482
|
value: function _emitError(error) {
|
|
30847
|
-
this._closeLastPc();
|
|
30848
31483
|
this.emit(EVENT$2.ERROR, error);
|
|
30849
31484
|
}
|
|
30850
31485
|
}, {
|
|
@@ -30856,7 +31491,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30856
31491
|
if (this._media && !((_this$_opts = this._opts) !== null && _this$_opts !== void 0 && _this$_opts.seamlesslyReload)) {
|
|
30857
31492
|
this._media.srcObject = null;
|
|
30858
31493
|
}
|
|
30859
|
-
this._closeLastPc();
|
|
30860
31494
|
if (this._pc) {
|
|
30861
31495
|
this._pc.close();
|
|
30862
31496
|
}
|
|
@@ -30885,64 +31519,6 @@ try {
|
|
|
30885
31519
|
}
|
|
30886
31520
|
} catch (error) {
|
|
30887
31521
|
}
|
|
30888
|
-
function isSupported$1() {
|
|
30889
|
-
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
30890
|
-
return false;
|
|
30891
|
-
}
|
|
30892
|
-
return true;
|
|
30893
|
-
}
|
|
30894
|
-
function getCapacity() {
|
|
30895
|
-
if (!isSupported$1())
|
|
30896
|
-
return Promise.reject("RTCPeerConnection no support");
|
|
30897
|
-
var pc;
|
|
30898
|
-
try {
|
|
30899
|
-
pc = new RTCPeerConnection();
|
|
30900
|
-
pc.addTransceiver("video", {
|
|
30901
|
-
direction: "recvonly"
|
|
30902
|
-
});
|
|
30903
|
-
pc.addTransceiver("audio", {
|
|
30904
|
-
direction: "recvonly"
|
|
30905
|
-
});
|
|
30906
|
-
} catch (e) {
|
|
30907
|
-
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
30908
|
-
}
|
|
30909
|
-
return pc.createOffer().then(function(offer) {
|
|
30910
|
-
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
30911
|
-
logger$6.log(offer.sdp);
|
|
30912
|
-
var sdpJson = lib$1.parse(offer.sdp);
|
|
30913
|
-
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x2) {
|
|
30914
|
-
return x2.type === "video";
|
|
30915
|
-
})[0];
|
|
30916
|
-
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x2) {
|
|
30917
|
-
return x2.type === "audio";
|
|
30918
|
-
})[0];
|
|
30919
|
-
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x2) {
|
|
30920
|
-
return x2.codec === "VP8" || x2.codec === "VP9" || x2.codec === "H264";
|
|
30921
|
-
});
|
|
30922
|
-
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x2) {
|
|
30923
|
-
return x2.codec === "opus";
|
|
30924
|
-
});
|
|
30925
|
-
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
30926
|
-
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
30927
|
-
vFmtp && vCodecs.map(function(codec) {
|
|
30928
|
-
var _vFmtp$filter$;
|
|
30929
|
-
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x2) {
|
|
30930
|
-
return x2.payload === codec.payload;
|
|
30931
|
-
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
30932
|
-
});
|
|
30933
|
-
aFmtp && aCodecs.map(function(codec) {
|
|
30934
|
-
var _aFmtp$filter$;
|
|
30935
|
-
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x2) {
|
|
30936
|
-
return x2.payload === codec.payload;
|
|
30937
|
-
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
30938
|
-
});
|
|
30939
|
-
pc.close();
|
|
30940
|
-
return {
|
|
30941
|
-
video: vCodecs,
|
|
30942
|
-
audio: aCodecs
|
|
30943
|
-
};
|
|
30944
|
-
});
|
|
30945
|
-
}
|
|
30946
31522
|
var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
30947
31523
|
_inherits$b(RtsPlugin2, _BasePlugin);
|
|
30948
31524
|
var _super = _createSuper$b(RtsPlugin2);
|
|
@@ -30957,26 +31533,26 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30957
31533
|
_defineProperty$c(_assertThisInitialized$b(_this), "_mediaStream", null);
|
|
30958
31534
|
_defineProperty$c(_assertThisInitialized$b(_this), "_rtsOpts", null);
|
|
30959
31535
|
_defineProperty$c(_assertThisInitialized$b(_this), "_onPause", function() {
|
|
30960
|
-
var _this$_rts, _this$
|
|
30961
|
-
if (!((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc)
|
|
31536
|
+
var _this$_rts, _this$config, _this$_rts3;
|
|
31537
|
+
if (!((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc)) {
|
|
30962
31538
|
return;
|
|
30963
31539
|
}
|
|
30964
31540
|
if ((_this$config = _this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
|
|
30965
|
-
var _this$
|
|
30966
|
-
_this._mediaStream = (_this$
|
|
31541
|
+
var _this$_rts2;
|
|
31542
|
+
_this._mediaStream = (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2._mediaStream;
|
|
30967
31543
|
}
|
|
30968
|
-
(_this$
|
|
31544
|
+
(_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
|
|
30969
31545
|
});
|
|
30970
31546
|
_defineProperty$c(_assertThisInitialized$b(_this), "_onPlay", function() {
|
|
30971
|
-
var _this$
|
|
30972
|
-
if ((_this$
|
|
31547
|
+
var _this$_rts4;
|
|
31548
|
+
if ((_this$_rts4 = _this._rts) !== null && _this$_rts4 !== void 0 && _this$_rts4._pc) {
|
|
30973
31549
|
return;
|
|
30974
31550
|
}
|
|
30975
31551
|
_this._init();
|
|
30976
31552
|
});
|
|
30977
31553
|
_defineProperty$c(_assertThisInitialized$b(_this), "_init", function() {
|
|
30978
|
-
var _this$
|
|
30979
|
-
(_this$
|
|
31554
|
+
var _this$_rts5;
|
|
31555
|
+
(_this$_rts5 = _this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.destroy();
|
|
30980
31556
|
var config = _this.player.config;
|
|
30981
31557
|
var rtsOpts = config.rts || {};
|
|
30982
31558
|
_this._rtsOpts = rtsOpts;
|
|
@@ -30993,39 +31569,36 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30993
31569
|
}, rtsOpts));
|
|
30994
31570
|
_this._rts.load(config.url);
|
|
30995
31571
|
});
|
|
30996
|
-
_defineProperty$c(_assertThisInitialized$b(_this), "_onSwitchURL", function(url
|
|
31572
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onSwitchURL", function(url) {
|
|
30997
31573
|
if (_this._rts) {
|
|
30998
|
-
if (_typeof$7(seamless) === "object") {
|
|
30999
|
-
seamless = seamless.seamless;
|
|
31000
|
-
}
|
|
31001
31574
|
_this.player.config.url = url;
|
|
31002
|
-
_this._rts.switchURL(url
|
|
31575
|
+
_this._rts.switchURL(url);
|
|
31003
31576
|
}
|
|
31004
31577
|
});
|
|
31005
31578
|
_defineProperty$c(_assertThisInitialized$b(_this), "destroy", function() {
|
|
31006
|
-
var _this$
|
|
31579
|
+
var _this$_rts6;
|
|
31007
31580
|
_this.player.switchURL = _this._originSwitchFn;
|
|
31008
|
-
(_this$
|
|
31581
|
+
(_this$_rts6 = _this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.destroy();
|
|
31009
31582
|
});
|
|
31010
31583
|
return _this;
|
|
31011
31584
|
}
|
|
31012
31585
|
_createClass$e(RtsPlugin2, [{
|
|
31013
31586
|
key: "pc",
|
|
31014
31587
|
get: function get3() {
|
|
31015
|
-
var _this$
|
|
31016
|
-
return (_this$
|
|
31588
|
+
var _this$_rts7;
|
|
31589
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.pc;
|
|
31017
31590
|
}
|
|
31018
31591
|
}, {
|
|
31019
31592
|
key: "videoTrack",
|
|
31020
31593
|
get: function get3() {
|
|
31021
|
-
var _this$
|
|
31022
|
-
return (_this$
|
|
31594
|
+
var _this$_rts8;
|
|
31595
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.videoTack;
|
|
31023
31596
|
}
|
|
31024
31597
|
}, {
|
|
31025
31598
|
key: "audioTrack",
|
|
31026
31599
|
get: function get3() {
|
|
31027
|
-
var _this$
|
|
31028
|
-
return (_this$
|
|
31600
|
+
var _this$_rts9;
|
|
31601
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.audioTrack;
|
|
31029
31602
|
}
|
|
31030
31603
|
}, {
|
|
31031
31604
|
key: "core",
|
|
@@ -31035,13 +31608,13 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31035
31608
|
}, {
|
|
31036
31609
|
key: "loader",
|
|
31037
31610
|
get: function get3() {
|
|
31038
|
-
var _this$
|
|
31039
|
-
return (_this$
|
|
31611
|
+
var _this$_rts10;
|
|
31612
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.loader;
|
|
31040
31613
|
}
|
|
31041
31614
|
}, {
|
|
31042
31615
|
key: "version",
|
|
31043
31616
|
get: function get3() {
|
|
31044
|
-
return "0.2.1-alpha.
|
|
31617
|
+
return "0.2.1-alpha.6";
|
|
31045
31618
|
}
|
|
31046
31619
|
}, {
|
|
31047
31620
|
key: "beforePlayerInit",
|
|
@@ -31069,6 +31642,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31069
31642
|
this._transCoreEvent(EVENT$2.LOAD_RESPONSE_HEADERS);
|
|
31070
31643
|
this._transCoreEvent(EVENT$2.LOAD_RETRY);
|
|
31071
31644
|
this._transCoreEvent(EVENT$2.METADATA_PARSED);
|
|
31645
|
+
this._transCoreEvent(EVENT$2.SEI);
|
|
31072
31646
|
this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
|
|
31073
31647
|
try {
|
|
31074
31648
|
BasePlugin.defineGetterOrSetter(this.player, {
|
|
@@ -31091,20 +31665,20 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31091
31665
|
}, {
|
|
31092
31666
|
key: "getStats",
|
|
31093
31667
|
value: function getStats2() {
|
|
31094
|
-
var _this$
|
|
31095
|
-
return (_this$
|
|
31668
|
+
var _this$_rts11;
|
|
31669
|
+
return (_this$_rts11 = this._rts) === null || _this$_rts11 === void 0 ? void 0 : _this$_rts11.getStats();
|
|
31096
31670
|
}
|
|
31097
31671
|
}, {
|
|
31098
31672
|
key: "getStatsSnapshoot",
|
|
31099
31673
|
value: function getStatsSnapshoot2() {
|
|
31100
|
-
var _this$
|
|
31101
|
-
return (_this$
|
|
31674
|
+
var _this$_rts12;
|
|
31675
|
+
return (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12.getStatsSnapshoot();
|
|
31102
31676
|
}
|
|
31103
31677
|
}, {
|
|
31104
31678
|
key: "getNetWorkInfo",
|
|
31105
31679
|
value: function getNetWorkInfo() {
|
|
31106
|
-
var _this$
|
|
31107
|
-
return (_this$
|
|
31680
|
+
var _this$_rts13;
|
|
31681
|
+
return (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.networkStats;
|
|
31108
31682
|
}
|
|
31109
31683
|
}, {
|
|
31110
31684
|
key: "_transErrorEvent",
|