@volcengine/veplayer-plugin 2.5.0-rc.0 → 2.5.0
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.d.ts +0 -1
- package/esm/index.development.css +0 -7
- package/esm/index.development.js +47254 -53339
- package/esm/index.production.css +1 -1
- package/esm/index.production.js +4 -13
- package/esm/veplayer.plugin.abr.development.js +12 -0
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.drm.development.js +12 -0
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +670 -193
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +1155 -371
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +13 -1
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +154 -45
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +12 -0
- package/esm/veplayer.plugin.shaka.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +0 -1
- package/umd/veplayer.plugin.abr.development.js +12 -0
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +12 -0
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +670 -193
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +1122 -338
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +13 -1
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +154 -45
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +12 -0
- package/umd/veplayer.plugin.shaka.production.js +1 -1
- package/esm/veplayer.plugin.ad.development.css +0 -7
- package/esm/veplayer.plugin.ad.development.js +0 -9042
- package/esm/veplayer.plugin.ad.production.css +0 -1
- package/esm/veplayer.plugin.ad.production.js +0 -4
- package/umd/veplayer.plugin.ad.development.css +0 -7
- package/umd/veplayer.plugin.ad.development.js +0 -9045
- package/umd/veplayer.plugin.ad.production.css +0 -1
- package/umd/veplayer.plugin.ad.production.js +0 -1
|
@@ -67,10 +67,10 @@ function _regeneratorRuntime$1() {
|
|
|
67
67
|
return obj[key] = value;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function wrap(innerFn, outerFn,
|
|
70
|
+
function wrap(innerFn, outerFn, self2, tryLocsList) {
|
|
71
71
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
|
|
72
72
|
return defineProperty(generator, "_invoke", {
|
|
73
|
-
value: makeInvokeMethod(innerFn,
|
|
73
|
+
value: makeInvokeMethod(innerFn, self2, context)
|
|
74
74
|
}), generator;
|
|
75
75
|
}
|
|
76
76
|
function tryCatch(fn, obj, arg) {
|
|
@@ -137,7 +137,7 @@ function _regeneratorRuntime$1() {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
function makeInvokeMethod(innerFn,
|
|
140
|
+
function makeInvokeMethod(innerFn, self2, context) {
|
|
141
141
|
var state = "suspendedStart";
|
|
142
142
|
return function(method, arg) {
|
|
143
143
|
if ("executing" === state)
|
|
@@ -166,7 +166,7 @@ function _regeneratorRuntime$1() {
|
|
|
166
166
|
} else
|
|
167
167
|
"return" === context.method && context.abrupt("return", context.arg);
|
|
168
168
|
state = "executing";
|
|
169
|
-
var record = tryCatch(innerFn,
|
|
169
|
+
var record = tryCatch(innerFn, self2, context);
|
|
170
170
|
if ("normal" === record.type) {
|
|
171
171
|
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
|
|
172
172
|
continue;
|
|
@@ -248,9 +248,9 @@ function _regeneratorRuntime$1() {
|
|
|
248
248
|
};
|
|
249
249
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
|
250
250
|
return this;
|
|
251
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn,
|
|
251
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
|
|
252
252
|
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
253
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn,
|
|
253
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
|
|
254
254
|
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
255
255
|
return result.done ? result.value : iter.next();
|
|
256
256
|
});
|
|
@@ -385,9 +385,9 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
385
385
|
}
|
|
386
386
|
function _asyncToGenerator$1(fn) {
|
|
387
387
|
return function() {
|
|
388
|
-
var
|
|
388
|
+
var self2 = this, args = arguments;
|
|
389
389
|
return new Promise(function(resolve, reject) {
|
|
390
|
-
var gen = fn.apply(
|
|
390
|
+
var gen = fn.apply(self2, args);
|
|
391
391
|
function _next(value) {
|
|
392
392
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
393
393
|
}
|
|
@@ -514,19 +514,19 @@ function _objectWithoutProperties$1(source, excluded) {
|
|
|
514
514
|
}
|
|
515
515
|
return target;
|
|
516
516
|
}
|
|
517
|
-
function _assertThisInitialized$2(
|
|
518
|
-
if (
|
|
517
|
+
function _assertThisInitialized$2(self2) {
|
|
518
|
+
if (self2 === void 0) {
|
|
519
519
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
520
520
|
}
|
|
521
|
-
return
|
|
521
|
+
return self2;
|
|
522
522
|
}
|
|
523
|
-
function _possibleConstructorReturn$2(
|
|
523
|
+
function _possibleConstructorReturn$2(self2, call) {
|
|
524
524
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
525
525
|
return call;
|
|
526
526
|
} else if (call !== void 0) {
|
|
527
527
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
528
528
|
}
|
|
529
|
-
return _assertThisInitialized$2(
|
|
529
|
+
return _assertThisInitialized$2(self2);
|
|
530
530
|
}
|
|
531
531
|
function _createSuper$2(Derived) {
|
|
532
532
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
@@ -1640,7 +1640,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
return offsetTime;
|
|
1642
1642
|
};
|
|
1643
|
-
var version = "3.0.
|
|
1643
|
+
var version = "3.0.21-rc.2";
|
|
1644
1644
|
var ERROR_MAP = {
|
|
1645
1645
|
1: 5101,
|
|
1646
1646
|
2: 5102,
|
|
@@ -2108,6 +2108,18 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
|
+
}, {
|
|
2112
|
+
key: "defineMethod",
|
|
2113
|
+
value: function defineMethod(Obj, map) {
|
|
2114
|
+
for (var key in map) {
|
|
2115
|
+
if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
|
|
2116
|
+
Object.defineProperty(Obj, key, {
|
|
2117
|
+
configurable: true,
|
|
2118
|
+
value: map[key]
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2111
2123
|
}, {
|
|
2112
2124
|
key: "defaultConfig",
|
|
2113
2125
|
get: function get() {
|
|
@@ -2164,10 +2176,10 @@ function _regeneratorRuntime() {
|
|
|
2164
2176
|
return obj[key] = value;
|
|
2165
2177
|
};
|
|
2166
2178
|
}
|
|
2167
|
-
function wrap(innerFn, outerFn,
|
|
2179
|
+
function wrap(innerFn, outerFn, self2, tryLocsList) {
|
|
2168
2180
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
|
|
2169
2181
|
return defineProperty(generator, "_invoke", {
|
|
2170
|
-
value: makeInvokeMethod(innerFn,
|
|
2182
|
+
value: makeInvokeMethod(innerFn, self2, context)
|
|
2171
2183
|
}), generator;
|
|
2172
2184
|
}
|
|
2173
2185
|
function tryCatch(fn, obj, arg) {
|
|
@@ -2234,7 +2246,7 @@ function _regeneratorRuntime() {
|
|
|
2234
2246
|
}
|
|
2235
2247
|
});
|
|
2236
2248
|
}
|
|
2237
|
-
function makeInvokeMethod(innerFn,
|
|
2249
|
+
function makeInvokeMethod(innerFn, self2, context) {
|
|
2238
2250
|
var state = "suspendedStart";
|
|
2239
2251
|
return function(method, arg) {
|
|
2240
2252
|
if ("executing" === state)
|
|
@@ -2263,7 +2275,7 @@ function _regeneratorRuntime() {
|
|
|
2263
2275
|
} else
|
|
2264
2276
|
"return" === context.method && context.abrupt("return", context.arg);
|
|
2265
2277
|
state = "executing";
|
|
2266
|
-
var record = tryCatch(innerFn,
|
|
2278
|
+
var record = tryCatch(innerFn, self2, context);
|
|
2267
2279
|
if ("normal" === record.type) {
|
|
2268
2280
|
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
|
|
2269
2281
|
continue;
|
|
@@ -2345,9 +2357,9 @@ function _regeneratorRuntime() {
|
|
|
2345
2357
|
};
|
|
2346
2358
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
|
2347
2359
|
return this;
|
|
2348
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn,
|
|
2360
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
|
|
2349
2361
|
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2350
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn,
|
|
2362
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
|
|
2351
2363
|
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
2352
2364
|
return result.done ? result.value : iter.next();
|
|
2353
2365
|
});
|
|
@@ -2482,9 +2494,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2482
2494
|
}
|
|
2483
2495
|
function _asyncToGenerator(fn) {
|
|
2484
2496
|
return function() {
|
|
2485
|
-
var
|
|
2497
|
+
var self2 = this, args = arguments;
|
|
2486
2498
|
return new Promise(function(resolve, reject) {
|
|
2487
|
-
var gen = fn.apply(
|
|
2499
|
+
var gen = fn.apply(self2, args);
|
|
2488
2500
|
function _next(value) {
|
|
2489
2501
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2490
2502
|
}
|
|
@@ -2658,19 +2670,19 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
2658
2670
|
}
|
|
2659
2671
|
return target;
|
|
2660
2672
|
}
|
|
2661
|
-
function _assertThisInitialized$1(
|
|
2662
|
-
if (
|
|
2673
|
+
function _assertThisInitialized$1(self2) {
|
|
2674
|
+
if (self2 === void 0) {
|
|
2663
2675
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2664
2676
|
}
|
|
2665
|
-
return
|
|
2677
|
+
return self2;
|
|
2666
2678
|
}
|
|
2667
|
-
function _possibleConstructorReturn$1(
|
|
2679
|
+
function _possibleConstructorReturn$1(self2, call) {
|
|
2668
2680
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
2669
2681
|
return call;
|
|
2670
2682
|
} else if (call !== void 0) {
|
|
2671
2683
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
2672
2684
|
}
|
|
2673
|
-
return _assertThisInitialized$1(
|
|
2685
|
+
return _assertThisInitialized$1(self2);
|
|
2674
2686
|
}
|
|
2675
2687
|
function _createSuper$1(Derived) {
|
|
2676
2688
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
@@ -2730,7 +2742,7 @@ function _arrayLikeToArray$1(arr, len) {
|
|
|
2730
2742
|
arr2[i] = arr[i];
|
|
2731
2743
|
return arr2;
|
|
2732
2744
|
}
|
|
2733
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
2745
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) {
|
|
2734
2746
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
2735
2747
|
if (!it) {
|
|
2736
2748
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
@@ -3085,7 +3097,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3085
3097
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
3086
3098
|
if (Logger2.disabled)
|
|
3087
3099
|
return;
|
|
3088
|
-
(_console = console).debug.apply(_console, [
|
|
3100
|
+
(_console = console).debug.apply(_console, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
3089
3101
|
}
|
|
3090
3102
|
}, {
|
|
3091
3103
|
key: "log",
|
|
@@ -3097,7 +3109,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3097
3109
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
3098
3110
|
if (Logger2.disabled)
|
|
3099
3111
|
return;
|
|
3100
|
-
(_console2 = console).log.apply(_console2, [
|
|
3112
|
+
(_console2 = console).log.apply(_console2, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
3101
3113
|
}
|
|
3102
3114
|
}, {
|
|
3103
3115
|
key: "warn",
|
|
@@ -3109,7 +3121,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3109
3121
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
3110
3122
|
if (Logger2.disabled)
|
|
3111
3123
|
return;
|
|
3112
|
-
(_console3 = console).warn.apply(_console3, [
|
|
3124
|
+
(_console3 = console).warn.apply(_console3, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
3113
3125
|
}
|
|
3114
3126
|
}, {
|
|
3115
3127
|
key: "error",
|
|
@@ -3121,7 +3133,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3121
3133
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
3122
3134
|
if (Logger2.disabled)
|
|
3123
3135
|
return;
|
|
3124
|
-
(_console4 = console).error.apply(_console4, [
|
|
3136
|
+
(_console4 = console).error.apply(_console4, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
3125
3137
|
}
|
|
3126
3138
|
}, {
|
|
3127
3139
|
key: "logCache",
|
|
@@ -3136,7 +3148,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3136
3148
|
var finLogText = logText.map(function(item) {
|
|
3137
3149
|
return logable(item);
|
|
3138
3150
|
});
|
|
3139
|
-
text =
|
|
3151
|
+
text = "[".concat(nowTime$1(), "]") + this._prefix + JSON.stringify(finLogText);
|
|
3140
3152
|
} catch (e) {
|
|
3141
3153
|
return;
|
|
3142
3154
|
}
|
|
@@ -4052,8 +4064,8 @@ function createResponse(data, done, response, contentLength, age, startTime, fir
|
|
|
4052
4064
|
response
|
|
4053
4065
|
};
|
|
4054
4066
|
}
|
|
4055
|
-
function calculateSpeed(byteLen,
|
|
4056
|
-
return Math.round(byteLen * 8 * 1e3 /
|
|
4067
|
+
function calculateSpeed(byteLen, milliSecond) {
|
|
4068
|
+
return Math.round(byteLen * 8 * 1e3 / milliSecond / 1024);
|
|
4057
4069
|
}
|
|
4058
4070
|
var EVENT = {
|
|
4059
4071
|
ERROR: "error",
|
|
@@ -4065,6 +4077,7 @@ var EVENT = {
|
|
|
4065
4077
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
4066
4078
|
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
4067
4079
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
4080
|
+
APPEND_BUFFER: "core.appendbuffer",
|
|
4068
4081
|
REMOVE_BUFFER: "core.removebuffer",
|
|
4069
4082
|
BUFFEREOS: "core.buffereos",
|
|
4070
4083
|
KEYFRAME: "core.keyframe",
|
|
@@ -4837,7 +4850,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4837
4850
|
value: function _getHeaders(xhr) {
|
|
4838
4851
|
var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
|
|
4839
4852
|
var headers = {};
|
|
4840
|
-
var _iterator = _createForOfIteratorHelper(headerLines), _step;
|
|
4853
|
+
var _iterator = _createForOfIteratorHelper$1(headerLines), _step;
|
|
4841
4854
|
try {
|
|
4842
4855
|
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4843
4856
|
var header = _step.value;
|
|
@@ -4859,7 +4872,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4859
4872
|
}]);
|
|
4860
4873
|
return XhrLoader2;
|
|
4861
4874
|
}(EventEmitter);
|
|
4862
|
-
var _excluded$
|
|
4875
|
+
var _excluded$2 = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4863
4876
|
var Task = /* @__PURE__ */ function() {
|
|
4864
4877
|
function Task2(type, config) {
|
|
4865
4878
|
_classCallCheck$1(this, Task2);
|
|
@@ -4879,7 +4892,7 @@ var Task = /* @__PURE__ */ function() {
|
|
|
4879
4892
|
key: "exec",
|
|
4880
4893
|
value: function exec() {
|
|
4881
4894
|
var _this = this;
|
|
4882
|
-
var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties(_this$_config, _excluded$
|
|
4895
|
+
var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties(_this$_config, _excluded$2);
|
|
4883
4896
|
var request = /* @__PURE__ */ function() {
|
|
4884
4897
|
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
4885
4898
|
var response, error, isRetry;
|
|
@@ -5604,19 +5617,19 @@ function _isNativeReflectConstruct() {
|
|
|
5604
5617
|
return false;
|
|
5605
5618
|
}
|
|
5606
5619
|
}
|
|
5607
|
-
function _assertThisInitialized(
|
|
5608
|
-
if (
|
|
5620
|
+
function _assertThisInitialized(self2) {
|
|
5621
|
+
if (self2 === void 0) {
|
|
5609
5622
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5610
5623
|
}
|
|
5611
|
-
return
|
|
5624
|
+
return self2;
|
|
5612
5625
|
}
|
|
5613
|
-
function _possibleConstructorReturn(
|
|
5626
|
+
function _possibleConstructorReturn(self2, call) {
|
|
5614
5627
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
5615
5628
|
return call;
|
|
5616
5629
|
} else if (call !== void 0) {
|
|
5617
5630
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
5618
5631
|
}
|
|
5619
|
-
return _assertThisInitialized(
|
|
5632
|
+
return _assertThisInitialized(self2);
|
|
5620
5633
|
}
|
|
5621
5634
|
function _createSuper(Derived) {
|
|
5622
5635
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
@@ -5675,6 +5688,60 @@ function _nonIterableSpread() {
|
|
|
5675
5688
|
function _nonIterableRest() {
|
|
5676
5689
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5677
5690
|
}
|
|
5691
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
5692
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
5693
|
+
if (!it) {
|
|
5694
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
5695
|
+
if (it)
|
|
5696
|
+
o = it;
|
|
5697
|
+
var i = 0;
|
|
5698
|
+
var F = function() {
|
|
5699
|
+
};
|
|
5700
|
+
return {
|
|
5701
|
+
s: F,
|
|
5702
|
+
n: function() {
|
|
5703
|
+
if (i >= o.length)
|
|
5704
|
+
return {
|
|
5705
|
+
done: true
|
|
5706
|
+
};
|
|
5707
|
+
return {
|
|
5708
|
+
done: false,
|
|
5709
|
+
value: o[i++]
|
|
5710
|
+
};
|
|
5711
|
+
},
|
|
5712
|
+
e: function(e) {
|
|
5713
|
+
throw e;
|
|
5714
|
+
},
|
|
5715
|
+
f: F
|
|
5716
|
+
};
|
|
5717
|
+
}
|
|
5718
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5719
|
+
}
|
|
5720
|
+
var normalCompletion = true, didErr = false, err;
|
|
5721
|
+
return {
|
|
5722
|
+
s: function() {
|
|
5723
|
+
it = it.call(o);
|
|
5724
|
+
},
|
|
5725
|
+
n: function() {
|
|
5726
|
+
var step = it.next();
|
|
5727
|
+
normalCompletion = step.done;
|
|
5728
|
+
return step;
|
|
5729
|
+
},
|
|
5730
|
+
e: function(e) {
|
|
5731
|
+
didErr = true;
|
|
5732
|
+
err = e;
|
|
5733
|
+
},
|
|
5734
|
+
f: function() {
|
|
5735
|
+
try {
|
|
5736
|
+
if (!normalCompletion && it.return != null)
|
|
5737
|
+
it.return();
|
|
5738
|
+
} finally {
|
|
5739
|
+
if (didErr)
|
|
5740
|
+
throw err;
|
|
5741
|
+
}
|
|
5742
|
+
}
|
|
5743
|
+
};
|
|
5744
|
+
}
|
|
5678
5745
|
function _toPrimitive(input, hint) {
|
|
5679
5746
|
if (typeof input !== "object" || input === null)
|
|
5680
5747
|
return input;
|
|
@@ -5697,13 +5764,16 @@ var TrackType = {
|
|
|
5697
5764
|
METADATA: "metadata"
|
|
5698
5765
|
};
|
|
5699
5766
|
var VideoCodecType = {
|
|
5767
|
+
AV1: "av1",
|
|
5700
5768
|
AVC: "avc",
|
|
5701
5769
|
HEVC: "hevc"
|
|
5702
5770
|
};
|
|
5703
5771
|
var AudioCodecType = {
|
|
5704
5772
|
AAC: "aac",
|
|
5705
5773
|
G711PCMA: "g7110a",
|
|
5706
|
-
G711PCMU: "g7110m"
|
|
5774
|
+
G711PCMU: "g7110m",
|
|
5775
|
+
OPUS: "opus",
|
|
5776
|
+
MP3: "mp3"
|
|
5707
5777
|
};
|
|
5708
5778
|
var WarningType = {
|
|
5709
5779
|
LARGE_AV_SHIFT: "LARGE_AV_SHIFT",
|
|
@@ -5743,6 +5813,7 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5743
5813
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5744
5814
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5745
5815
|
_defineProperty(this, "isVideo", true);
|
|
5816
|
+
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5746
5817
|
_defineProperty(this, "kid", null);
|
|
5747
5818
|
_defineProperty(this, "pssh", null);
|
|
5748
5819
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5785,6 +5856,9 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5785
5856
|
}, {
|
|
5786
5857
|
key: "exist",
|
|
5787
5858
|
value: function exist() {
|
|
5859
|
+
if (/av01/.test(this.codec)) {
|
|
5860
|
+
return true;
|
|
5861
|
+
}
|
|
5788
5862
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5789
5863
|
}
|
|
5790
5864
|
}, {
|
|
@@ -5808,6 +5882,7 @@ var AudioTrack = /* @__PURE__ */ function() {
|
|
|
5808
5882
|
_defineProperty(this, "codecType", AudioCodecType.AAC);
|
|
5809
5883
|
_defineProperty(this, "pid", -1);
|
|
5810
5884
|
_defineProperty(this, "codec", "");
|
|
5885
|
+
_defineProperty(this, "container", "");
|
|
5811
5886
|
_defineProperty(this, "sequenceNumber", 0);
|
|
5812
5887
|
_defineProperty(this, "sampleDuration", 0);
|
|
5813
5888
|
_defineProperty(this, "timescale", 0);
|
|
@@ -5848,7 +5923,7 @@ var AudioTrack = /* @__PURE__ */ function() {
|
|
|
5848
5923
|
}, {
|
|
5849
5924
|
key: "exist",
|
|
5850
5925
|
value: function exist() {
|
|
5851
|
-
return !!(this.sampleRate && this.channelCount && this.codec && this.codecType === AudioCodecType.AAC);
|
|
5926
|
+
return !!(this.sampleRate && this.channelCount && (this.codec || this.container) && (this.codecType === AudioCodecType.AAC || this.codecType === AudioCodecType.G711PCMA || this.codecType === AudioCodecType.G711PCMU || this.codecType === AudioCodecType.OPUS || this.codecType === AudioCodecType.MP3));
|
|
5852
5927
|
}
|
|
5853
5928
|
}, {
|
|
5854
5929
|
key: "hasSample",
|
|
@@ -7236,6 +7311,115 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
7236
7311
|
}]);
|
|
7237
7312
|
return TsFixer2;
|
|
7238
7313
|
}();
|
|
7314
|
+
var BitratesMap = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160];
|
|
7315
|
+
var FREQ = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3];
|
|
7316
|
+
var SamplesCoefficients = [
|
|
7317
|
+
[
|
|
7318
|
+
0,
|
|
7319
|
+
72,
|
|
7320
|
+
144,
|
|
7321
|
+
12
|
|
7322
|
+
],
|
|
7323
|
+
[
|
|
7324
|
+
0,
|
|
7325
|
+
0,
|
|
7326
|
+
0,
|
|
7327
|
+
0
|
|
7328
|
+
],
|
|
7329
|
+
[
|
|
7330
|
+
0,
|
|
7331
|
+
72,
|
|
7332
|
+
144,
|
|
7333
|
+
12
|
|
7334
|
+
],
|
|
7335
|
+
[
|
|
7336
|
+
0,
|
|
7337
|
+
144,
|
|
7338
|
+
144,
|
|
7339
|
+
12
|
|
7340
|
+
]
|
|
7341
|
+
];
|
|
7342
|
+
var BytesInSlot = [
|
|
7343
|
+
0,
|
|
7344
|
+
1,
|
|
7345
|
+
1,
|
|
7346
|
+
4
|
|
7347
|
+
];
|
|
7348
|
+
var chromeVersion = null;
|
|
7349
|
+
var MPEG = /* @__PURE__ */ function() {
|
|
7350
|
+
function MPEG2() {
|
|
7351
|
+
_classCallCheck(this, MPEG2);
|
|
7352
|
+
}
|
|
7353
|
+
_createClass(MPEG2, null, [{
|
|
7354
|
+
key: "isHeader",
|
|
7355
|
+
value: function isHeader(data, offset) {
|
|
7356
|
+
return offset + 1 < data.length && data[offset] === 255 && (data[offset + 1] & 224) === 224 && (data[offset + 1] & 6) !== 0;
|
|
7357
|
+
}
|
|
7358
|
+
}, {
|
|
7359
|
+
key: "appendFrame",
|
|
7360
|
+
value: function appendFrame(track, data, offset, pts, frameIndex) {
|
|
7361
|
+
if (offset + 24 > data.length) {
|
|
7362
|
+
return;
|
|
7363
|
+
}
|
|
7364
|
+
var header = MPEG2.parseHeader(data, offset);
|
|
7365
|
+
if (header && offset + header.frameLength <= data.length) {
|
|
7366
|
+
var frameDuration = header.samplesPerFrame * 9e4 / header.sampleRate;
|
|
7367
|
+
var stamp = pts + frameIndex * frameDuration;
|
|
7368
|
+
var sample = {
|
|
7369
|
+
data: data.subarray(offset, offset + header.frameLength),
|
|
7370
|
+
pts: stamp,
|
|
7371
|
+
dts: stamp
|
|
7372
|
+
};
|
|
7373
|
+
sample.size = sample.data.byteLength;
|
|
7374
|
+
track.config = [];
|
|
7375
|
+
track.channelCount = header.channelCount;
|
|
7376
|
+
track.sampleRate = header.sampleRate;
|
|
7377
|
+
track.container = "audio/mpeg";
|
|
7378
|
+
track.samples.push(sample);
|
|
7379
|
+
return {
|
|
7380
|
+
length: header.frameLength
|
|
7381
|
+
};
|
|
7382
|
+
}
|
|
7383
|
+
}
|
|
7384
|
+
}, {
|
|
7385
|
+
key: "parseHeader",
|
|
7386
|
+
value: function parseHeader(data, offset) {
|
|
7387
|
+
var mpegVersion = data[offset + 1] >> 3 & 3;
|
|
7388
|
+
var mpegLayer = data[offset + 1] >> 1 & 3;
|
|
7389
|
+
var bitRateIndex = data[offset + 2] >> 4 & 15;
|
|
7390
|
+
var sampleRateIndex = data[offset + 2] >> 2 & 3;
|
|
7391
|
+
if (mpegVersion !== 1 && bitRateIndex !== 0 && bitRateIndex !== 15 && sampleRateIndex !== 3) {
|
|
7392
|
+
var paddingBit = data[offset + 2] >> 1 & 1;
|
|
7393
|
+
var channelMode = data[offset + 3] >> 6;
|
|
7394
|
+
var columnInBitrates = mpegVersion === 3 ? 3 - mpegLayer : mpegLayer === 3 ? 3 : 4;
|
|
7395
|
+
var bitRate = BitratesMap[columnInBitrates * 14 + bitRateIndex - 1] * 1e3;
|
|
7396
|
+
var columnInSampleRates = mpegVersion === 3 ? 0 : mpegVersion === 2 ? 1 : 2;
|
|
7397
|
+
var sampleRate = FREQ[columnInSampleRates * 3 + sampleRateIndex];
|
|
7398
|
+
var channelCount = channelMode === 3 ? 1 : 2;
|
|
7399
|
+
var sampleCoefficient = SamplesCoefficients[mpegVersion][mpegLayer];
|
|
7400
|
+
var bytesInSlot = BytesInSlot[mpegLayer];
|
|
7401
|
+
var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;
|
|
7402
|
+
var frameLength = Math.floor(sampleCoefficient * bitRate / sampleRate + paddingBit) * bytesInSlot;
|
|
7403
|
+
if (chromeVersion === null) {
|
|
7404
|
+
var userAgent = navigator.userAgent || "";
|
|
7405
|
+
var result = userAgent.match(/Chrome\/(\d+)/i);
|
|
7406
|
+
chromeVersion = result ? parseInt(result[1]) : 0;
|
|
7407
|
+
}
|
|
7408
|
+
var needChromeFix = !!chromeVersion && chromeVersion <= 87;
|
|
7409
|
+
if (needChromeFix && mpegLayer === 2 && bitRate >= 224e3 && channelMode === 0) {
|
|
7410
|
+
data[offset + 3] = data[offset + 3] | 128;
|
|
7411
|
+
}
|
|
7412
|
+
return {
|
|
7413
|
+
sampleRate,
|
|
7414
|
+
channelCount,
|
|
7415
|
+
frameLength,
|
|
7416
|
+
samplesPerFrame
|
|
7417
|
+
};
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
}]);
|
|
7421
|
+
return MPEG2;
|
|
7422
|
+
}();
|
|
7239
7423
|
var logger$4 = new Logger$1("TsDemuxer");
|
|
7240
7424
|
var TsDemuxer = /* @__PURE__ */ function() {
|
|
7241
7425
|
function TsDemuxer2(videoTrack, audioTrack, metadataTrack) {
|
|
@@ -7319,6 +7503,11 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7319
7503
|
case 15:
|
|
7320
7504
|
audioTrack.pid = audioPid = esPid;
|
|
7321
7505
|
break;
|
|
7506
|
+
case 3:
|
|
7507
|
+
case 4:
|
|
7508
|
+
audioTrack.pid = audioPid = esPid;
|
|
7509
|
+
audioTrack.codecType = AudioCodecType.MP3;
|
|
7510
|
+
break;
|
|
7322
7511
|
case 27:
|
|
7323
7512
|
if (videoPid !== -1)
|
|
7324
7513
|
break;
|
|
@@ -7518,7 +7707,14 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7518
7707
|
logger$4.warn("Cannot parse audio pes", this._audioPesData);
|
|
7519
7708
|
return;
|
|
7520
7709
|
}
|
|
7521
|
-
this.
|
|
7710
|
+
switch (this.audioTrack.codecType) {
|
|
7711
|
+
case AudioCodecType.AAC:
|
|
7712
|
+
this._parseAacData(pes);
|
|
7713
|
+
break;
|
|
7714
|
+
case AudioCodecType.MP3:
|
|
7715
|
+
this._parseMPEG(pes);
|
|
7716
|
+
break;
|
|
7717
|
+
}
|
|
7522
7718
|
this._audioPesData = [];
|
|
7523
7719
|
}
|
|
7524
7720
|
}, {
|
|
@@ -7555,6 +7751,32 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7555
7751
|
logger$4.warn("Cannot parse aac adts", pes);
|
|
7556
7752
|
}
|
|
7557
7753
|
}
|
|
7754
|
+
}, {
|
|
7755
|
+
key: "_parseMPEG",
|
|
7756
|
+
value: function _parseMPEG(pes) {
|
|
7757
|
+
var data = pes.data;
|
|
7758
|
+
var length = data.length;
|
|
7759
|
+
var frameIndex = 0;
|
|
7760
|
+
var offset = 0;
|
|
7761
|
+
var pts = pes.pts;
|
|
7762
|
+
if (pts === void 0) {
|
|
7763
|
+
logger$4.warn("[tsdemuxer]: MPEG PES unknown PTS");
|
|
7764
|
+
return;
|
|
7765
|
+
}
|
|
7766
|
+
while (offset < length) {
|
|
7767
|
+
if (MPEG.isHeader(data, offset)) {
|
|
7768
|
+
var frame = MPEG.appendFrame(this.audioTrack, data, offset, pts, frameIndex);
|
|
7769
|
+
if (frame) {
|
|
7770
|
+
offset += frame.length;
|
|
7771
|
+
frameIndex++;
|
|
7772
|
+
} else {
|
|
7773
|
+
break;
|
|
7774
|
+
}
|
|
7775
|
+
} else {
|
|
7776
|
+
offset++;
|
|
7777
|
+
}
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7558
7780
|
}], [{
|
|
7559
7781
|
key: "probe",
|
|
7560
7782
|
value: function probe(data) {
|
|
@@ -7601,7 +7823,7 @@ var ByteReader = /* @__PURE__ */ function() {
|
|
|
7601
7823
|
_classCallCheck(this, ByteReader2);
|
|
7602
7824
|
this.dv = new DataView(buf);
|
|
7603
7825
|
this.start = this.offset = offset || this.dv.byteOffset;
|
|
7604
|
-
this.end = len ? this.start + len : this.dv.byteLength;
|
|
7826
|
+
this.end = len ? this.start + len : this.start + this.dv.byteLength;
|
|
7605
7827
|
}
|
|
7606
7828
|
_createClass(ByteReader2, [{
|
|
7607
7829
|
key: "buffer",
|
|
@@ -7703,7 +7925,7 @@ var ByteReader = /* @__PURE__ */ function() {
|
|
|
7703
7925
|
value: function readToBuffer(len) {
|
|
7704
7926
|
var buffer;
|
|
7705
7927
|
if (this.offset || len) {
|
|
7706
|
-
buffer = this.dv.buffer.slice(this.offset, len ? this.offset + len :
|
|
7928
|
+
buffer = this.dv.buffer.slice(this.offset, len ? this.offset + len : this.end);
|
|
7707
7929
|
} else {
|
|
7708
7930
|
buffer = this.dv.buffer;
|
|
7709
7931
|
}
|
|
@@ -7756,6 +7978,47 @@ var ByteReader = /* @__PURE__ */ function() {
|
|
|
7756
7978
|
}]);
|
|
7757
7979
|
return ByteReader2;
|
|
7758
7980
|
}();
|
|
7981
|
+
var BitReader = /* @__PURE__ */ function() {
|
|
7982
|
+
function BitReader2(val, size) {
|
|
7983
|
+
_classCallCheck(this, BitReader2);
|
|
7984
|
+
this.offset = 0;
|
|
7985
|
+
this.val = val;
|
|
7986
|
+
this.size = size;
|
|
7987
|
+
}
|
|
7988
|
+
_createClass(BitReader2, [{
|
|
7989
|
+
key: "skip",
|
|
7990
|
+
value: function skip(len) {
|
|
7991
|
+
this.offset += len;
|
|
7992
|
+
}
|
|
7993
|
+
}, {
|
|
7994
|
+
key: "read",
|
|
7995
|
+
value: function read(len) {
|
|
7996
|
+
var unreadLength = this.size - this.offset - len;
|
|
7997
|
+
if (unreadLength >= 0) {
|
|
7998
|
+
var bits = 0, i = 0;
|
|
7999
|
+
this.offset += len;
|
|
8000
|
+
if (this.size > 31) {
|
|
8001
|
+
for (; i < len; i++) {
|
|
8002
|
+
bits += Math.pow(2, i);
|
|
8003
|
+
}
|
|
8004
|
+
return this.val / Math.pow(2, unreadLength) & bits;
|
|
8005
|
+
} else {
|
|
8006
|
+
for (; i < len; i++) {
|
|
8007
|
+
bits += 1 << i;
|
|
8008
|
+
}
|
|
8009
|
+
return this.val >>> unreadLength & bits;
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
throw new Error("the number of the read operation exceeds the total length limit of bits");
|
|
8013
|
+
}
|
|
8014
|
+
}], [{
|
|
8015
|
+
key: "fromByte",
|
|
8016
|
+
value: function fromByte(byte, len) {
|
|
8017
|
+
return new BitReader2(byte.read(len), len << 3);
|
|
8018
|
+
}
|
|
8019
|
+
}]);
|
|
8020
|
+
return BitReader2;
|
|
8021
|
+
}();
|
|
7759
8022
|
var MP4Parser = /* @__PURE__ */ function() {
|
|
7760
8023
|
function MP4Parser2() {
|
|
7761
8024
|
_classCallCheck(this, MP4Parser2);
|
|
@@ -8095,6 +8358,8 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
8095
8358
|
ret.entryCount = readBig32(data);
|
|
8096
8359
|
ret.entries = MP4Parser2.findBox(data.subarray(4), [], start + 4).map(function(b) {
|
|
8097
8360
|
switch (b.type) {
|
|
8361
|
+
case "av01":
|
|
8362
|
+
return MP4Parser2.av01(b);
|
|
8098
8363
|
case "avc1":
|
|
8099
8364
|
case "avc2":
|
|
8100
8365
|
case "avc3":
|
|
@@ -8174,6 +8439,69 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
8174
8439
|
}
|
|
8175
8440
|
});
|
|
8176
8441
|
}
|
|
8442
|
+
}, {
|
|
8443
|
+
key: "colr",
|
|
8444
|
+
value: function colr(box) {
|
|
8445
|
+
return parseBox(box, false, function(ret, data) {
|
|
8446
|
+
var byte = ByteReader.fromUint8(data);
|
|
8447
|
+
ret.data = box.data;
|
|
8448
|
+
ret.colorType = byte.readString(4);
|
|
8449
|
+
if (ret.colorType === "nclx") {
|
|
8450
|
+
ret.colorPrimaries = byte.read(2);
|
|
8451
|
+
ret.transferCharacteristics = byte.read(2);
|
|
8452
|
+
ret.matrixCoefficients = byte.read(2);
|
|
8453
|
+
ret.fullRangeFlag = byte.read(1) >> 7;
|
|
8454
|
+
} else if (ret.colorType === "rICC" || ret.colorType === "prof") {
|
|
8455
|
+
ret.iccProfile = data.readToUint8();
|
|
8456
|
+
}
|
|
8457
|
+
});
|
|
8458
|
+
}
|
|
8459
|
+
}, {
|
|
8460
|
+
key: "av01",
|
|
8461
|
+
value: function av01(box) {
|
|
8462
|
+
return parseBox(box, false, function(ret, data, start) {
|
|
8463
|
+
var bodyStart = parseVisualSampleEntry(ret, data);
|
|
8464
|
+
var bodyData = data.subarray(bodyStart);
|
|
8465
|
+
start += bodyStart;
|
|
8466
|
+
ret.av1C = MP4Parser2.av1C(MP4Parser2.findBox(bodyData, ["av1C"], start)[0]);
|
|
8467
|
+
ret.colr = MP4Parser2.colr(MP4Parser2.findBox(bodyData, ["colr"], start)[0]);
|
|
8468
|
+
});
|
|
8469
|
+
}
|
|
8470
|
+
}, {
|
|
8471
|
+
key: "av1C",
|
|
8472
|
+
value: function av1C(box) {
|
|
8473
|
+
return parseBox(box, false, function(ret, data) {
|
|
8474
|
+
ret.data = box.data;
|
|
8475
|
+
var byte = ByteReader.fromUint8(data);
|
|
8476
|
+
var bit = BitReader.fromByte(byte, 4);
|
|
8477
|
+
ret.marker = bit.read(1);
|
|
8478
|
+
ret.version = bit.read(7);
|
|
8479
|
+
ret.seqProfile = bit.read(3);
|
|
8480
|
+
ret.seqLevelIdx0 = bit.read(5);
|
|
8481
|
+
ret.seqTier0 = bit.read(1);
|
|
8482
|
+
ret.highBitdepth = bit.read(1);
|
|
8483
|
+
ret.twelveBit = bit.read(1);
|
|
8484
|
+
ret.monochrome = bit.read(1);
|
|
8485
|
+
ret.chromaSubsamplingX = bit.read(1);
|
|
8486
|
+
ret.chromaSubsamplingY = bit.read(1);
|
|
8487
|
+
ret.chromaSamplePosition = bit.read(2);
|
|
8488
|
+
ret.reserved = bit.read(3);
|
|
8489
|
+
ret.initialPresentationDelayPresent = bit.read(1);
|
|
8490
|
+
if (ret.initialPresentationDelayPresent) {
|
|
8491
|
+
ret.initialPresentationDelayMinusOne = bit.read(4);
|
|
8492
|
+
} else {
|
|
8493
|
+
ret.initialPresentationDelayMinusOne = 0;
|
|
8494
|
+
}
|
|
8495
|
+
ret.configOBUs = byte.readToUint8();
|
|
8496
|
+
var bitdepth;
|
|
8497
|
+
if (ret.seqLevelIdx0 === 2 && ret.highBitdepth === 1) {
|
|
8498
|
+
bitdepth = ret.twelveBit === 1 ? "12" : "10";
|
|
8499
|
+
} else if (ret.seqProfile <= 2) {
|
|
8500
|
+
bitdepth = ret.highBitdepth === 1 ? "10" : "08";
|
|
8501
|
+
}
|
|
8502
|
+
ret.codec = ["av01", ret.seqProfile, (ret.seqLevelIdx0 < 10 ? "0" + ret.seqLevelIdx0 : ret.seqLevelIdx0) + (ret.seqTier0 ? "H" : "M"), bitdepth].join(".");
|
|
8503
|
+
});
|
|
8504
|
+
}
|
|
8177
8505
|
}, {
|
|
8178
8506
|
key: "avc1",
|
|
8179
8507
|
value: function avc1(box) {
|
|
@@ -8607,7 +8935,12 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
8607
8935
|
if (e1.pasp) {
|
|
8608
8936
|
v.sarRatio = [e1.pasp.hSpacing, e1.pasp.vSpacing];
|
|
8609
8937
|
}
|
|
8610
|
-
if (e1.
|
|
8938
|
+
if (e1.av1C) {
|
|
8939
|
+
v.codecType = VideoCodecType.AV1;
|
|
8940
|
+
v.codec = e1.av1C.codec;
|
|
8941
|
+
v.av1C = e1.av1C.data;
|
|
8942
|
+
v.colr = e1.colr.data;
|
|
8943
|
+
} else if (e1.hvcC) {
|
|
8611
8944
|
v.codecType = VideoCodecType.HEVC;
|
|
8612
8945
|
v.codec = e1.hvcC.codec;
|
|
8613
8946
|
v.vps = e1.hvcC.vps;
|
|
@@ -8926,8 +9259,9 @@ function parseAudioSampleEntry(ret, data) {
|
|
|
8926
9259
|
function parseBox(box, isFullBox, parse3) {
|
|
8927
9260
|
if (!box)
|
|
8928
9261
|
return;
|
|
8929
|
-
if (box.size !== box.data.length)
|
|
9262
|
+
if (box.size !== box.data.length) {
|
|
8930
9263
|
throw new Error("box ".concat(box.type, " size !== data.length"));
|
|
9264
|
+
}
|
|
8931
9265
|
var ret = {
|
|
8932
9266
|
start: box.start,
|
|
8933
9267
|
size: box.size,
|
|
@@ -8966,11 +9300,167 @@ var toHex = function toHex2() {
|
|
|
8966
9300
|
var FMP4Demuxer = /* @__PURE__ */ function() {
|
|
8967
9301
|
function FMP4Demuxer2(videoTrack, audioTrack, metadataTrack) {
|
|
8968
9302
|
_classCallCheck(this, FMP4Demuxer2);
|
|
9303
|
+
_defineProperty(this, "__loadedMoofWraps", []);
|
|
9304
|
+
_defineProperty(this, "__lastRemainData", null);
|
|
9305
|
+
_defineProperty(this, "__lastRemainDataStart", 0);
|
|
9306
|
+
_defineProperty(this, "__nextMoofStart", -1);
|
|
8969
9307
|
this.videoTrack = videoTrack || new VideoTrack();
|
|
8970
9308
|
this.audioTrack = audioTrack || new AudioTrack();
|
|
8971
9309
|
this.metadataTrack = metadataTrack || new MetadataTrack();
|
|
8972
9310
|
}
|
|
8973
9311
|
_createClass(FMP4Demuxer2, [{
|
|
9312
|
+
key: "demuxPart",
|
|
9313
|
+
value: function demuxPart(partData, partDataStart, moov) {
|
|
9314
|
+
var _this = this;
|
|
9315
|
+
var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
|
|
9316
|
+
var videoExist = videoTrack.exist();
|
|
9317
|
+
var audioExist = audioTrack.exist();
|
|
9318
|
+
var isAV01 = /av01/.test(videoTrack.codec);
|
|
9319
|
+
videoTrack.samples = [];
|
|
9320
|
+
audioTrack.samples = [];
|
|
9321
|
+
var data = partData;
|
|
9322
|
+
var dataStart = partDataStart;
|
|
9323
|
+
if (this.__lastRemainData) {
|
|
9324
|
+
var lastRemainDataEnd = this.__lastRemainDataStart + this.__lastRemainData.byteLength;
|
|
9325
|
+
var continuous = partDataStart <= lastRemainDataEnd && partDataStart > this.__lastRemainDataStart && partDataStart + partData.byteLength > lastRemainDataEnd;
|
|
9326
|
+
if (continuous) {
|
|
9327
|
+
var noDuplicateData = partData.subarray(this.__lastRemainData.byteLength + this.__lastRemainDataStart - partDataStart);
|
|
9328
|
+
data = concatUint8Array(this.__lastRemainData, noDuplicateData);
|
|
9329
|
+
dataStart = this.__lastRemainDataStart;
|
|
9330
|
+
this.__lastRemainData = null;
|
|
9331
|
+
} else {
|
|
9332
|
+
this.__lastRemainData = null;
|
|
9333
|
+
this.__lastRemainDataStart = 0;
|
|
9334
|
+
this.__nextMoofStart = -1;
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
if (!moov) {
|
|
9338
|
+
var moovBox = MP4Parser.findBox(data, ["moov"])[0];
|
|
9339
|
+
if (!moovBox)
|
|
9340
|
+
throw new Error("cannot found moov box");
|
|
9341
|
+
moov = MP4Parser.moov(moovBox);
|
|
9342
|
+
}
|
|
9343
|
+
if (data) {
|
|
9344
|
+
var dataEnd = dataStart + data.byteLength;
|
|
9345
|
+
if (!videoExist && !audioExist) {
|
|
9346
|
+
MP4Parser.moovToTrack(moov, videoTrack, audioTrack);
|
|
9347
|
+
}
|
|
9348
|
+
var moofBoxes = [];
|
|
9349
|
+
if (this.__nextMoofStart < 0) {
|
|
9350
|
+
MP4Parser.findBox(data, ["moof"], dataStart).forEach(function(v) {
|
|
9351
|
+
return moofBoxes.push(v);
|
|
9352
|
+
});
|
|
9353
|
+
} else if (this.__nextMoofStart >= dataStart && this.__nextMoofStart <= dataEnd - 8) {
|
|
9354
|
+
MP4Parser.findBox(data.subarray(this.__nextMoofStart - dataStart), ["moof"], this.__nextMoofStart).forEach(function(v) {
|
|
9355
|
+
return moofBoxes.push(v);
|
|
9356
|
+
});
|
|
9357
|
+
}
|
|
9358
|
+
moofBoxes.filter(function(moofBox) {
|
|
9359
|
+
return moofBox.size <= moofBox.data.length;
|
|
9360
|
+
}).forEach(function(moofBox) {
|
|
9361
|
+
var moof = MP4Parser.moof(moofBox);
|
|
9362
|
+
_this.__nextMoofStart = moof.start + Math.max.apply(Math, _toConsumableArray(moof.traf.map(function(v) {
|
|
9363
|
+
return v.trun.samples.reduce(function(ret, w) {
|
|
9364
|
+
return ret + w.size;
|
|
9365
|
+
}, v.trun.dataOffset || 0);
|
|
9366
|
+
})));
|
|
9367
|
+
_this.__loadedMoofWraps.push({
|
|
9368
|
+
start: moof.start,
|
|
9369
|
+
nextMoofStart: _this.__nextMoofStart,
|
|
9370
|
+
moof
|
|
9371
|
+
});
|
|
9372
|
+
_this.__loadedMoofWraps.sort(function(p, n) {
|
|
9373
|
+
return p.start - n.start;
|
|
9374
|
+
});
|
|
9375
|
+
});
|
|
9376
|
+
var _iterator = _createForOfIteratorHelper(this.__loadedMoofWraps), _step;
|
|
9377
|
+
try {
|
|
9378
|
+
var _loop = function _loop2() {
|
|
9379
|
+
var moofWrap = _step.value;
|
|
9380
|
+
if (moofWrap.start > dataEnd || moofWrap.nextMoofStart < dataStart) {
|
|
9381
|
+
return "continue";
|
|
9382
|
+
}
|
|
9383
|
+
var moofStart = moofWrap.start;
|
|
9384
|
+
var tracks = MP4Parser.moofToSamples(moofWrap.moof, videoTrack, audioTrack);
|
|
9385
|
+
var videoBaseMediaDecodeTime = videoTrack.baseMediaDecodeTime;
|
|
9386
|
+
var audioBaseMediaDecodeTime = audioTrack.baseMediaDecodeTime;
|
|
9387
|
+
var nalSize;
|
|
9388
|
+
Object.keys(tracks).forEach(function(k) {
|
|
9389
|
+
if (videoTrack.id == k) {
|
|
9390
|
+
tracks[k].some(function(x) {
|
|
9391
|
+
var xStart = x.offset += moofStart;
|
|
9392
|
+
if (xStart < dataStart) {
|
|
9393
|
+
return;
|
|
9394
|
+
}
|
|
9395
|
+
if (xStart + x.size > dataEnd) {
|
|
9396
|
+
return true;
|
|
9397
|
+
}
|
|
9398
|
+
var sample = new VideoSample((x.pts || x.dts) + videoBaseMediaDecodeTime, x.dts + videoBaseMediaDecodeTime);
|
|
9399
|
+
sample.duration = x.duration;
|
|
9400
|
+
sample.gopId = x.gopId;
|
|
9401
|
+
if (x.keyframe)
|
|
9402
|
+
sample.setToKeyframe();
|
|
9403
|
+
var sampleData = data.subarray(xStart - dataStart, xStart - dataStart + x.size);
|
|
9404
|
+
sample.data = sampleData;
|
|
9405
|
+
if (!isAV01) {
|
|
9406
|
+
var start = 0;
|
|
9407
|
+
var len = sampleData.length - 1;
|
|
9408
|
+
while (start < len) {
|
|
9409
|
+
nalSize = readBig32(sampleData, start);
|
|
9410
|
+
start += 4;
|
|
9411
|
+
sample.units.push(sampleData.subarray(start, start + nalSize));
|
|
9412
|
+
start += nalSize;
|
|
9413
|
+
}
|
|
9414
|
+
}
|
|
9415
|
+
_this.__lastRemainDataStart = xStart + x.size;
|
|
9416
|
+
videoTrack.samples.push(sample);
|
|
9417
|
+
});
|
|
9418
|
+
} else if (audioTrack.id == k) {
|
|
9419
|
+
tracks[k].some(function(x) {
|
|
9420
|
+
var xStart = x.offset + moofStart;
|
|
9421
|
+
if (xStart < dataStart) {
|
|
9422
|
+
return;
|
|
9423
|
+
}
|
|
9424
|
+
if (xStart + x.size > dataEnd) {
|
|
9425
|
+
return true;
|
|
9426
|
+
}
|
|
9427
|
+
var sampleData = data.subarray(xStart - dataStart, xStart - dataStart + x.size);
|
|
9428
|
+
audioTrack.samples.push(new AudioSample(x.dts + audioBaseMediaDecodeTime, sampleData, x.duration));
|
|
9429
|
+
_this.__lastRemainDataStart = xStart + x.size;
|
|
9430
|
+
});
|
|
9431
|
+
}
|
|
9432
|
+
});
|
|
9433
|
+
};
|
|
9434
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
9435
|
+
var _ret = _loop();
|
|
9436
|
+
if (_ret === "continue")
|
|
9437
|
+
continue;
|
|
9438
|
+
}
|
|
9439
|
+
} catch (err) {
|
|
9440
|
+
_iterator.e(err);
|
|
9441
|
+
} finally {
|
|
9442
|
+
_iterator.f();
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
if (this.__lastRemainDataStart > dataStart && this.__lastRemainDataStart < data.byteLength + dataStart) {
|
|
9446
|
+
this.__lastRemainData = data.subarray(this.__lastRemainDataStart - dataStart);
|
|
9447
|
+
} else {
|
|
9448
|
+
this.__lastRemainData = data;
|
|
9449
|
+
this.__lastRemainDataStart = dataStart;
|
|
9450
|
+
}
|
|
9451
|
+
if (videoTrack.samples.length) {
|
|
9452
|
+
videoTrack.baseMediaDecodeTime = videoTrack.samples[0].pts;
|
|
9453
|
+
}
|
|
9454
|
+
if (audioTrack.samples.length) {
|
|
9455
|
+
audioTrack.baseMediaDecodeTime = audioTrack.samples[0].pts;
|
|
9456
|
+
}
|
|
9457
|
+
return {
|
|
9458
|
+
videoTrack,
|
|
9459
|
+
audioTrack,
|
|
9460
|
+
metadataTrack: this.metadataTrack
|
|
9461
|
+
};
|
|
9462
|
+
}
|
|
9463
|
+
}, {
|
|
8974
9464
|
key: "demux",
|
|
8975
9465
|
value: function demux(videoData, audioData) {
|
|
8976
9466
|
var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
|
|
@@ -9089,13 +9579,13 @@ var Buffer = /* @__PURE__ */ function() {
|
|
|
9089
9579
|
_createClass(Buffer2, [{
|
|
9090
9580
|
key: "write",
|
|
9091
9581
|
value: function write() {
|
|
9092
|
-
var
|
|
9582
|
+
var self2 = this;
|
|
9093
9583
|
for (var _len2 = arguments.length, buffer = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
9094
9584
|
buffer[_key2] = arguments[_key2];
|
|
9095
9585
|
}
|
|
9096
9586
|
buffer.forEach(function(item) {
|
|
9097
9587
|
if (item) {
|
|
9098
|
-
|
|
9588
|
+
self2.buffer = Concat(Uint8Array, self2.buffer, item);
|
|
9099
9589
|
} else {
|
|
9100
9590
|
window.console.warn(item);
|
|
9101
9591
|
}
|
|
@@ -9462,10 +9952,16 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9462
9952
|
if (track.useEME && track.enca) {
|
|
9463
9953
|
content = MP42.enca(track);
|
|
9464
9954
|
} else {
|
|
9465
|
-
|
|
9955
|
+
if (track.codecType === AudioCodecType.OPUS) {
|
|
9956
|
+
content = MP42.opus(track);
|
|
9957
|
+
} else {
|
|
9958
|
+
content = MP42.mp4a(track);
|
|
9959
|
+
}
|
|
9466
9960
|
}
|
|
9467
9961
|
} else if (track.useEME && track.encv) {
|
|
9468
9962
|
content = MP42.encv(track);
|
|
9963
|
+
} else if (track.av1C) {
|
|
9964
|
+
content = MP42.av01(track);
|
|
9469
9965
|
} else {
|
|
9470
9966
|
content = MP42.avc1hev1(track);
|
|
9471
9967
|
}
|
|
@@ -9679,12 +10175,9 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9679
10175
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
9680
10176
|
}
|
|
9681
10177
|
}, {
|
|
9682
|
-
key: "
|
|
9683
|
-
value: function
|
|
9684
|
-
|
|
9685
|
-
var typ = isHevc ? MP42.types.hvc1 : MP42.types.avc1;
|
|
9686
|
-
var config = isHevc ? MP42.hvcC(track) : MP42.avcC(track);
|
|
9687
|
-
var boxes = [new Uint8Array([
|
|
10178
|
+
key: "av01",
|
|
10179
|
+
value: function av01(track) {
|
|
10180
|
+
return MP42.box(MP42.types.av01, new Uint8Array([
|
|
9688
10181
|
0,
|
|
9689
10182
|
0,
|
|
9690
10183
|
0,
|
|
@@ -9763,50 +10256,137 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9763
10256
|
24,
|
|
9764
10257
|
17,
|
|
9765
10258
|
17
|
|
9766
|
-
]),
|
|
9767
|
-
if (isHevc) {
|
|
9768
|
-
boxes.push(MP42.box(MP42.types.fiel, new Uint8Array([1, 0])));
|
|
9769
|
-
} else if (track.sarRatio && track.sarRatio.length > 1) {
|
|
9770
|
-
boxes.push(MP42.pasp(track.sarRatio));
|
|
9771
|
-
}
|
|
9772
|
-
return MP42.box.apply(MP42, [typ].concat(boxes));
|
|
10259
|
+
]), track.av1C, track.colr);
|
|
9773
10260
|
}
|
|
9774
10261
|
}, {
|
|
9775
|
-
key: "
|
|
9776
|
-
value: function
|
|
9777
|
-
var
|
|
9778
|
-
var
|
|
9779
|
-
var
|
|
9780
|
-
var
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
len = p.byteLength;
|
|
9789
|
-
pps.push(len >>> 8 & 255);
|
|
9790
|
-
pps.push(len & 255);
|
|
9791
|
-
pps.push.apply(pps, _toConsumableArray(p));
|
|
9792
|
-
});
|
|
9793
|
-
return MP42.box(MP42.types.avcC, new Uint8Array((_concat$concat2 = (_ref2 = [
|
|
10262
|
+
key: "avc1hev1",
|
|
10263
|
+
value: function avc1hev1(track) {
|
|
10264
|
+
var isHevc = track.codecType === VideoCodecType.HEVC;
|
|
10265
|
+
var typ = isHevc ? MP42.types.hvc1 : MP42.types.avc1;
|
|
10266
|
+
var config = isHevc ? MP42.hvcC(track) : MP42.avcC(track);
|
|
10267
|
+
var boxes = [new Uint8Array([
|
|
10268
|
+
0,
|
|
10269
|
+
0,
|
|
10270
|
+
0,
|
|
10271
|
+
0,
|
|
10272
|
+
0,
|
|
10273
|
+
0,
|
|
10274
|
+
0,
|
|
9794
10275
|
1,
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
10276
|
+
0,
|
|
10277
|
+
0,
|
|
10278
|
+
0,
|
|
10279
|
+
0,
|
|
10280
|
+
0,
|
|
10281
|
+
0,
|
|
10282
|
+
0,
|
|
10283
|
+
0,
|
|
10284
|
+
0,
|
|
10285
|
+
0,
|
|
10286
|
+
0,
|
|
10287
|
+
0,
|
|
10288
|
+
0,
|
|
10289
|
+
0,
|
|
10290
|
+
0,
|
|
10291
|
+
0,
|
|
10292
|
+
track.width >> 8 & 255,
|
|
10293
|
+
track.width & 255,
|
|
10294
|
+
track.height >> 8 & 255,
|
|
10295
|
+
track.height & 255,
|
|
10296
|
+
0,
|
|
10297
|
+
72,
|
|
10298
|
+
0,
|
|
10299
|
+
0,
|
|
10300
|
+
0,
|
|
10301
|
+
72,
|
|
10302
|
+
0,
|
|
10303
|
+
0,
|
|
10304
|
+
0,
|
|
10305
|
+
0,
|
|
10306
|
+
0,
|
|
10307
|
+
0,
|
|
10308
|
+
0,
|
|
10309
|
+
1,
|
|
10310
|
+
0,
|
|
10311
|
+
0,
|
|
10312
|
+
0,
|
|
10313
|
+
0,
|
|
10314
|
+
0,
|
|
10315
|
+
0,
|
|
10316
|
+
0,
|
|
10317
|
+
0,
|
|
10318
|
+
0,
|
|
10319
|
+
0,
|
|
10320
|
+
0,
|
|
10321
|
+
0,
|
|
10322
|
+
0,
|
|
10323
|
+
0,
|
|
10324
|
+
0,
|
|
10325
|
+
0,
|
|
10326
|
+
0,
|
|
10327
|
+
0,
|
|
10328
|
+
0,
|
|
10329
|
+
0,
|
|
10330
|
+
0,
|
|
10331
|
+
0,
|
|
10332
|
+
0,
|
|
10333
|
+
0,
|
|
10334
|
+
0,
|
|
10335
|
+
0,
|
|
10336
|
+
0,
|
|
10337
|
+
0,
|
|
10338
|
+
0,
|
|
10339
|
+
0,
|
|
10340
|
+
0,
|
|
10341
|
+
0,
|
|
10342
|
+
0,
|
|
10343
|
+
24,
|
|
10344
|
+
17,
|
|
10345
|
+
17
|
|
10346
|
+
]), config];
|
|
10347
|
+
if (isHevc) {
|
|
10348
|
+
boxes.push(MP42.box(MP42.types.fiel, new Uint8Array([1, 0])));
|
|
10349
|
+
} else if (track.sarRatio && track.sarRatio.length > 1) {
|
|
10350
|
+
boxes.push(MP42.pasp(track.sarRatio));
|
|
10351
|
+
}
|
|
10352
|
+
return MP42.box.apply(MP42, [typ].concat(boxes));
|
|
10353
|
+
}
|
|
10354
|
+
}, {
|
|
10355
|
+
key: "avcC",
|
|
10356
|
+
value: function avcC(track) {
|
|
10357
|
+
var _concat$concat2, _ref2;
|
|
10358
|
+
var sps = [];
|
|
10359
|
+
var pps = [];
|
|
10360
|
+
var len;
|
|
10361
|
+
track.sps.forEach(function(s) {
|
|
10362
|
+
len = s.byteLength;
|
|
10363
|
+
sps.push(len >>> 8 & 255);
|
|
10364
|
+
sps.push(len & 255);
|
|
10365
|
+
sps.push.apply(sps, _toConsumableArray(s));
|
|
10366
|
+
});
|
|
10367
|
+
track.pps.forEach(function(p) {
|
|
10368
|
+
len = p.byteLength;
|
|
10369
|
+
pps.push(len >>> 8 & 255);
|
|
10370
|
+
pps.push(len & 255);
|
|
10371
|
+
pps.push.apply(pps, _toConsumableArray(p));
|
|
10372
|
+
});
|
|
10373
|
+
return MP42.box(MP42.types.avcC, new Uint8Array((_concat$concat2 = (_ref2 = [
|
|
10374
|
+
1,
|
|
10375
|
+
sps[3],
|
|
10376
|
+
sps[4],
|
|
10377
|
+
sps[5],
|
|
10378
|
+
252 | 3,
|
|
10379
|
+
224 | track.sps.length
|
|
10380
|
+
]).concat.apply(_ref2, sps).concat([track.pps.length])).concat.apply(_concat$concat2, pps)));
|
|
10381
|
+
}
|
|
10382
|
+
}, {
|
|
10383
|
+
key: "hvcC",
|
|
10384
|
+
value: function hvcC(track) {
|
|
10385
|
+
var hvcC2 = track.hvcC;
|
|
10386
|
+
if (hvcC2 instanceof ArrayBuffer || hvcC2 instanceof Uint8Array)
|
|
10387
|
+
return hvcC2;
|
|
10388
|
+
var vps = track.vps, sps = track.sps, pps = track.pps;
|
|
10389
|
+
var data;
|
|
9810
10390
|
if (hvcC2) {
|
|
9811
10391
|
var pcf = hvcC2.generalProfileCompatibilityFlags;
|
|
9812
10392
|
var cif = hvcC2.generalConstraintIndicatorFlags;
|
|
@@ -10048,6 +10628,53 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
10048
10628
|
)));
|
|
10049
10629
|
return esds2;
|
|
10050
10630
|
}
|
|
10631
|
+
}, {
|
|
10632
|
+
key: "opus",
|
|
10633
|
+
value: function opus(track) {
|
|
10634
|
+
var opusAudioDescription = new Uint8Array([
|
|
10635
|
+
0,
|
|
10636
|
+
0,
|
|
10637
|
+
0,
|
|
10638
|
+
0,
|
|
10639
|
+
0,
|
|
10640
|
+
0,
|
|
10641
|
+
0,
|
|
10642
|
+
1,
|
|
10643
|
+
0,
|
|
10644
|
+
0,
|
|
10645
|
+
0,
|
|
10646
|
+
0,
|
|
10647
|
+
0,
|
|
10648
|
+
0,
|
|
10649
|
+
0,
|
|
10650
|
+
0,
|
|
10651
|
+
0,
|
|
10652
|
+
track.channelCount,
|
|
10653
|
+
0,
|
|
10654
|
+
16,
|
|
10655
|
+
0,
|
|
10656
|
+
0,
|
|
10657
|
+
0,
|
|
10658
|
+
0,
|
|
10659
|
+
track.sampleRate >> 8 & 255,
|
|
10660
|
+
track.sampleRate & 255,
|
|
10661
|
+
0,
|
|
10662
|
+
0
|
|
10663
|
+
]);
|
|
10664
|
+
var opusSpecificConfig = track.config.length ? MP42.dOps(track) : [];
|
|
10665
|
+
return MP42.box(MP42.types.Opus, opusAudioDescription, opusSpecificConfig);
|
|
10666
|
+
}
|
|
10667
|
+
}, {
|
|
10668
|
+
key: "dOps",
|
|
10669
|
+
value: function dOps(track) {
|
|
10670
|
+
if (track.config) {
|
|
10671
|
+
track.config[4] = track.sampleRate >>> 24 & 255;
|
|
10672
|
+
track.config[5] = track.sampleRate >>> 16 & 255;
|
|
10673
|
+
track.config[6] = track.sampleRate >>> 8 & 255;
|
|
10674
|
+
track.config[7] = track.sampleRate & 255;
|
|
10675
|
+
return MP42.box(MP42.types.dOps, track.config);
|
|
10676
|
+
}
|
|
10677
|
+
}
|
|
10051
10678
|
}, {
|
|
10052
10679
|
key: "mvex",
|
|
10053
10680
|
value: function mvex(tracks) {
|
|
@@ -10650,7 +11277,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
10650
11277
|
}]);
|
|
10651
11278
|
return MP42;
|
|
10652
11279
|
}();
|
|
10653
|
-
_defineProperty(MP4, "types", ["avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
|
|
11280
|
+
_defineProperty(MP4, "types", ["Opus", "dOps", "av01", "av1C", "avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
|
|
10654
11281
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
10655
11282
|
return p;
|
|
10656
11283
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -10985,30 +11612,46 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
10985
11612
|
};
|
|
10986
11613
|
}
|
|
10987
11614
|
var samples = track.samples;
|
|
11615
|
+
var isAV01 = /av01/.test(track.codec);
|
|
10988
11616
|
var mdatSize = 0;
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
}
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
var sampleSize = 0;
|
|
11000
|
-
_sample.units.forEach(function(u) {
|
|
11001
|
-
mdatView.setUint32(_offset, u.byteLength);
|
|
11002
|
-
_offset += 4;
|
|
11003
|
-
mdata.set(u, _offset);
|
|
11004
|
-
_offset += u.byteLength;
|
|
11005
|
-
sampleSize += 4 + u.byteLength;
|
|
11617
|
+
if (isAV01) {
|
|
11618
|
+
samples.forEach(function(s) {
|
|
11619
|
+
mdatSize += s.data.byteLength;
|
|
11620
|
+
});
|
|
11621
|
+
} else {
|
|
11622
|
+
samples.forEach(function(s) {
|
|
11623
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
11624
|
+
return t + c.byteLength;
|
|
11625
|
+
}, 0);
|
|
11626
|
+
mdatSize += s.units.length * 4;
|
|
11006
11627
|
});
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11628
|
+
}
|
|
11629
|
+
var mdata = new Uint8Array(mdatSize);
|
|
11630
|
+
if (isAV01) {
|
|
11631
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
11632
|
+
sample = samples[i];
|
|
11633
|
+
mdata.set(sample.data, offset);
|
|
11634
|
+
sample.size = sample.data.byteLength;
|
|
11635
|
+
offset += sample.size;
|
|
11636
|
+
}
|
|
11637
|
+
} else {
|
|
11638
|
+
var mdatView = new DataView(mdata.buffer);
|
|
11639
|
+
var _loop = function _loop2(_offset2, _sample2) {
|
|
11640
|
+
_sample2 = samples[_i];
|
|
11641
|
+
var sampleSize = 0;
|
|
11642
|
+
_sample2.units.forEach(function(u) {
|
|
11643
|
+
mdatView.setUint32(_offset2, u.byteLength);
|
|
11644
|
+
_offset2 += 4;
|
|
11645
|
+
mdata.set(u, _offset2);
|
|
11646
|
+
_offset2 += u.byteLength;
|
|
11647
|
+
sampleSize += 4 + u.byteLength;
|
|
11648
|
+
});
|
|
11649
|
+
_sample2.size = sampleSize;
|
|
11650
|
+
_offset = _offset2, _sample = _sample2;
|
|
11651
|
+
};
|
|
11652
|
+
for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
|
|
11653
|
+
_loop(_offset, _sample);
|
|
11654
|
+
}
|
|
11012
11655
|
}
|
|
11013
11656
|
var mdat = MP4.mdat(mdata);
|
|
11014
11657
|
var moof = MP4.moof([track]);
|
|
@@ -11202,7 +11845,8 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
11202
11845
|
timescale: audioTrack.timescale,
|
|
11203
11846
|
firstDts: audioTrack.firstDts / videoTrack.timescale,
|
|
11204
11847
|
firstPts: audioTrack.firstPts / videoTrack.timescale,
|
|
11205
|
-
duration: audioTrack.samplesDuration / videoTrack.timescale
|
|
11848
|
+
duration: audioTrack.samplesDuration / videoTrack.timescale,
|
|
11849
|
+
container: audioTrack.container
|
|
11206
11850
|
};
|
|
11207
11851
|
var newId = "".concat(videoTrack.codec, "/").concat(videoTrack.width, "/").concat(videoTrack.height, "/").concat(audioTrack.codec, "/").concat(audioTrack.config);
|
|
11208
11852
|
if (newId !== this._initSegmentId) {
|
|
@@ -11326,7 +11970,7 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
11326
11970
|
}]);
|
|
11327
11971
|
return Transmuxer2;
|
|
11328
11972
|
}();
|
|
11329
|
-
var _excluded = ["data"], _excluded2 = ["data"];
|
|
11973
|
+
var _excluded$1 = ["data"], _excluded2 = ["data"];
|
|
11330
11974
|
var logger$2 = new Logger$2("BufferService");
|
|
11331
11975
|
var BufferService = /* @__PURE__ */ function() {
|
|
11332
11976
|
function BufferService2(hls) {
|
|
@@ -11492,7 +12136,8 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11492
12136
|
key: "appendBuffer",
|
|
11493
12137
|
value: function() {
|
|
11494
12138
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(segment, audioSegment, videoChunk, audioChunk, discontinuity, contiguous, startTime) {
|
|
11495
|
-
var
|
|
12139
|
+
var _this2 = this;
|
|
12140
|
+
var afterAppend, p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p, videoData, videoRest, audioData, audioRest;
|
|
11496
12141
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
11497
12142
|
while (1)
|
|
11498
12143
|
switch (_context2.prev = _context2.next) {
|
|
@@ -11503,8 +12148,18 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11503
12148
|
}
|
|
11504
12149
|
return _context2.abrupt("return");
|
|
11505
12150
|
case 2:
|
|
12151
|
+
afterAppend = function afterAppend2() {
|
|
12152
|
+
var _this2$hls;
|
|
12153
|
+
if ((_this2$hls = _this2.hls) !== null && _this2$hls !== void 0 && _this2$hls.emit) {
|
|
12154
|
+
var _this2$hls2;
|
|
12155
|
+
(_this2$hls2 = _this2.hls) === null || _this2$hls2 === void 0 ? void 0 : _this2$hls2.emit(EVENT.APPEND_BUFFER, {
|
|
12156
|
+
start: segment.start,
|
|
12157
|
+
end: segment.end
|
|
12158
|
+
});
|
|
12159
|
+
}
|
|
12160
|
+
};
|
|
11506
12161
|
if (!this._directAppend) {
|
|
11507
|
-
_context2.next =
|
|
12162
|
+
_context2.next = 8;
|
|
11508
12163
|
break;
|
|
11509
12164
|
}
|
|
11510
12165
|
p = [];
|
|
@@ -11512,8 +12167,8 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11512
12167
|
p.push(this._mse.append(MSE.VIDEO, videoChunk));
|
|
11513
12168
|
if (audioChunk)
|
|
11514
12169
|
p.push(this._mse.append(MSE.AUDIO, audioChunk));
|
|
11515
|
-
return _context2.abrupt("return", Promise.all(p));
|
|
11516
|
-
case
|
|
12170
|
+
return _context2.abrupt("return", Promise.all(p).then(afterAppend));
|
|
12171
|
+
case 8:
|
|
11517
12172
|
needInit = this._needInitSegment || discontinuity;
|
|
11518
12173
|
_this$_transmuxer$tra = this._transmuxer.transmux(videoChunk, audioChunk, needInit, contiguous, startTime, this._needInitSegment || discontinuity), _this$_transmuxer$tra2 = _slicedToArray$1(_this$_transmuxer$tra, 2), video = _this$_transmuxer$tra2[0], audio = _this$_transmuxer$tra2[1];
|
|
11519
12174
|
if (audioChunk && audioSegment) {
|
|
@@ -11529,21 +12184,22 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11529
12184
|
this.hls.emit(Event$1.NO_AUDIO_TRACK);
|
|
11530
12185
|
}
|
|
11531
12186
|
if (!this._softVideo) {
|
|
11532
|
-
_context2.next =
|
|
12187
|
+
_context2.next = 20;
|
|
11533
12188
|
break;
|
|
11534
12189
|
}
|
|
11535
12190
|
this._softVideo.appendBuffer(video, audio);
|
|
11536
12191
|
this._needInitSegment = false;
|
|
11537
|
-
|
|
12192
|
+
afterAppend();
|
|
12193
|
+
_context2.next = 30;
|
|
11538
12194
|
break;
|
|
11539
|
-
case
|
|
12195
|
+
case 20:
|
|
11540
12196
|
if (!this._mse) {
|
|
11541
|
-
_context2.next =
|
|
12197
|
+
_context2.next = 30;
|
|
11542
12198
|
break;
|
|
11543
12199
|
}
|
|
11544
12200
|
isFirstAppend = !this._sourceCreated;
|
|
11545
12201
|
if (isFirstAppend) {
|
|
11546
|
-
this._createMseSource(video === null || video === void 0 ? void 0 : video.codec, audio === null || audio === void 0 ? void 0 : audio.codec);
|
|
12202
|
+
this._createMseSource(video === null || video === void 0 ? void 0 : video.codec, audio === null || audio === void 0 ? void 0 : audio.codec, audio === null || audio === void 0 ? void 0 : audio.container);
|
|
11547
12203
|
}
|
|
11548
12204
|
this._needInitSegment = false;
|
|
11549
12205
|
mse = this._mse;
|
|
@@ -11554,15 +12210,15 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11554
12210
|
});
|
|
11555
12211
|
}
|
|
11556
12212
|
if (video) {
|
|
11557
|
-
videoData = video.data, videoRest = _objectWithoutProperties$1(video, _excluded);
|
|
12213
|
+
videoData = video.data, videoRest = _objectWithoutProperties$1(video, _excluded$1);
|
|
11558
12214
|
_p.push(mse.append(MSE.VIDEO, videoData, videoRest));
|
|
11559
12215
|
}
|
|
11560
12216
|
if (audio) {
|
|
11561
12217
|
audioData = audio.data, audioRest = _objectWithoutProperties$1(audio, _excluded2);
|
|
11562
12218
|
_p.push(mse.append(MSE.AUDIO, audioData, audioRest));
|
|
11563
12219
|
}
|
|
11564
|
-
return _context2.abrupt("return", Promise.all(_p));
|
|
11565
|
-
case
|
|
12220
|
+
return _context2.abrupt("return", Promise.all(_p).then(afterAppend));
|
|
12221
|
+
case 30:
|
|
11566
12222
|
case "end":
|
|
11567
12223
|
return _context2.stop();
|
|
11568
12224
|
}
|
|
@@ -11577,7 +12233,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11577
12233
|
key: "removeBuffer",
|
|
11578
12234
|
value: function() {
|
|
11579
12235
|
var _removeBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
11580
|
-
var
|
|
12236
|
+
var _this3 = this;
|
|
11581
12237
|
var start, end, media, _args3 = arguments;
|
|
11582
12238
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
11583
12239
|
while (1)
|
|
@@ -11593,7 +12249,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11593
12249
|
return _context3.abrupt("return");
|
|
11594
12250
|
case 5:
|
|
11595
12251
|
return _context3.abrupt("return", this._mse.clearBuffer(start, end).then(function() {
|
|
11596
|
-
return
|
|
12252
|
+
return _this3.hls.emit(EVENT.REMOVE_BUFFER, {
|
|
11597
12253
|
start,
|
|
11598
12254
|
end,
|
|
11599
12255
|
removeEnd: end
|
|
@@ -11774,30 +12430,51 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11774
12430
|
return setLiveSeekableRange;
|
|
11775
12431
|
}()
|
|
11776
12432
|
}, {
|
|
11777
|
-
key: "
|
|
12433
|
+
key: "detachMedia",
|
|
11778
12434
|
value: function() {
|
|
11779
|
-
var
|
|
11780
|
-
var _this$_decryptor;
|
|
12435
|
+
var _detachMedia = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
11781
12436
|
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
11782
12437
|
while (1)
|
|
11783
12438
|
switch (_context9.prev = _context9.next) {
|
|
11784
12439
|
case 0:
|
|
11785
|
-
(_this$_decryptor = this._decryptor) === null || _this$_decryptor === void 0 ? void 0 : _this$_decryptor.destroy();
|
|
11786
12440
|
if (!this._mse) {
|
|
11787
|
-
_context9.next =
|
|
12441
|
+
_context9.next = 3;
|
|
11788
12442
|
break;
|
|
11789
12443
|
}
|
|
11790
|
-
_context9.next =
|
|
12444
|
+
_context9.next = 3;
|
|
11791
12445
|
return this._mse.unbindMedia();
|
|
11792
|
-
case
|
|
12446
|
+
case 3:
|
|
12447
|
+
case "end":
|
|
12448
|
+
return _context9.stop();
|
|
12449
|
+
}
|
|
12450
|
+
}, _callee9, this);
|
|
12451
|
+
}));
|
|
12452
|
+
function detachMedia() {
|
|
12453
|
+
return _detachMedia.apply(this, arguments);
|
|
12454
|
+
}
|
|
12455
|
+
return detachMedia;
|
|
12456
|
+
}()
|
|
12457
|
+
}, {
|
|
12458
|
+
key: "destroy",
|
|
12459
|
+
value: function() {
|
|
12460
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10() {
|
|
12461
|
+
var _this$_decryptor;
|
|
12462
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
12463
|
+
while (1)
|
|
12464
|
+
switch (_context10.prev = _context10.next) {
|
|
12465
|
+
case 0:
|
|
12466
|
+
(_this$_decryptor = this._decryptor) === null || _this$_decryptor === void 0 ? void 0 : _this$_decryptor.destroy();
|
|
12467
|
+
_context10.next = 3;
|
|
12468
|
+
return this.detachMedia();
|
|
12469
|
+
case 3:
|
|
11793
12470
|
this._decryptor = null;
|
|
11794
12471
|
this._mse = null;
|
|
11795
12472
|
this._softVideo = null;
|
|
11796
|
-
case
|
|
12473
|
+
case 6:
|
|
11797
12474
|
case "end":
|
|
11798
|
-
return
|
|
12475
|
+
return _context10.stop();
|
|
11799
12476
|
}
|
|
11800
|
-
},
|
|
12477
|
+
}, _callee10, this);
|
|
11801
12478
|
}));
|
|
11802
12479
|
function destroy() {
|
|
11803
12480
|
return _destroy.apply(this, arguments);
|
|
@@ -11806,7 +12483,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11806
12483
|
}()
|
|
11807
12484
|
}, {
|
|
11808
12485
|
key: "_createMseSource",
|
|
11809
|
-
value: function _createMseSource(videoCodec, audioCodec) {
|
|
12486
|
+
value: function _createMseSource(videoCodec, audioCodec, container) {
|
|
11810
12487
|
logger$2.debug("create mse source, videoCodec=".concat(videoCodec, ", audioCodec=").concat(audioCodec));
|
|
11811
12488
|
var mse = this._mse;
|
|
11812
12489
|
if (!mse)
|
|
@@ -11818,6 +12495,9 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11818
12495
|
if (audioCodec) {
|
|
11819
12496
|
mse.createSource(MSE.AUDIO, "audio/mp4;codecs=".concat(audioCodec));
|
|
11820
12497
|
this._sourceCreated = true;
|
|
12498
|
+
} else if (container) {
|
|
12499
|
+
mse.createSource(MSE.AUDIO, "".concat(container, ';codecs=""'));
|
|
12500
|
+
this._sourceCreated = true;
|
|
11821
12501
|
}
|
|
11822
12502
|
this.hls.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
11823
12503
|
}
|
|
@@ -12127,6 +12807,31 @@ var MediaSegmentKey = /* @__PURE__ */ function() {
|
|
|
12127
12807
|
}]);
|
|
12128
12808
|
return MediaSegmentKey2;
|
|
12129
12809
|
}();
|
|
12810
|
+
var HlsUrlParameters = /* @__PURE__ */ function() {
|
|
12811
|
+
function HlsUrlParameters2(msn, part, skip) {
|
|
12812
|
+
_classCallCheck$3(this, HlsUrlParameters2);
|
|
12813
|
+
this.msn = msn;
|
|
12814
|
+
this.part = part;
|
|
12815
|
+
this.skip = skip;
|
|
12816
|
+
}
|
|
12817
|
+
_createClass$3(HlsUrlParameters2, [{
|
|
12818
|
+
key: "addDirectives",
|
|
12819
|
+
value: function addDirectives(uri) {
|
|
12820
|
+
var url = new self.URL(uri);
|
|
12821
|
+
if (this.msn !== void 0) {
|
|
12822
|
+
url.searchParams.set("_HLS_msn", this.msn.toString());
|
|
12823
|
+
}
|
|
12824
|
+
if (this.part) {
|
|
12825
|
+
url.searchParams.set("_HLS_part", this.part.toString());
|
|
12826
|
+
}
|
|
12827
|
+
if (this.skip) {
|
|
12828
|
+
url.searchParams.set("_HLS_skip", this.skip);
|
|
12829
|
+
}
|
|
12830
|
+
return url.href;
|
|
12831
|
+
}
|
|
12832
|
+
}]);
|
|
12833
|
+
return HlsUrlParameters2;
|
|
12834
|
+
}();
|
|
12130
12835
|
var REGEXP_TAG = /^#(EXT[^:]*)(?::(.*))?$/;
|
|
12131
12836
|
var REGEXP_ATTR = /([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;
|
|
12132
12837
|
var REGEXP_ABSOLUTE_URL = /^(?:[a-zA-Z0-9+\-.]+:)?\/\//;
|
|
@@ -12365,7 +13070,7 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12365
13070
|
media.canBlockReload = _attr["CAN-BLOCK-RELOAD"] === "YES";
|
|
12366
13071
|
media.partHoldBack = parseFloat(_attr["PART-HOLD-BACK"] || 0);
|
|
12367
13072
|
media.canSkipUntil = parseFloat(_attr["CAN-SKIP-UNTIL"] || 0);
|
|
12368
|
-
media.canSkipDateRanges = _attr["CAN-SKIP-DATERANGES"] === "YES";
|
|
13073
|
+
media.canSkipDateRanges = media.canSkipUntil > 0 && _attr["CAN-SKIP-DATERANGES"] === "YES";
|
|
12369
13074
|
}
|
|
12370
13075
|
break;
|
|
12371
13076
|
case "ENDLIST":
|
|
@@ -12409,6 +13114,15 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12409
13114
|
}
|
|
12410
13115
|
break;
|
|
12411
13116
|
case "PRELOAD-HINT":
|
|
13117
|
+
{
|
|
13118
|
+
var _attr3 = parseAttr(data);
|
|
13119
|
+
media.preloadHint = _attr3;
|
|
13120
|
+
if (_attr3["TYPE"] === "PART" && _attr3["URI"]) {
|
|
13121
|
+
var tmp = _attr3["URI"].split(".ts")[0].split("-");
|
|
13122
|
+
media.nextSN = tmp[3];
|
|
13123
|
+
media.nextIndex = tmp[tmp.length - 1];
|
|
13124
|
+
}
|
|
13125
|
+
}
|
|
12412
13126
|
break;
|
|
12413
13127
|
case "PROGRAM-DATE-TIME":
|
|
12414
13128
|
curSegment.dataTime = data;
|
|
@@ -12428,21 +13142,21 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12428
13142
|
break;
|
|
12429
13143
|
case "KEY":
|
|
12430
13144
|
{
|
|
12431
|
-
var
|
|
12432
|
-
if (
|
|
13145
|
+
var _attr4 = parseAttr(data);
|
|
13146
|
+
if (_attr4.METHOD === "NONE") {
|
|
12433
13147
|
curKey = null;
|
|
12434
13148
|
break;
|
|
12435
13149
|
}
|
|
12436
13150
|
curKey = new MediaSegmentKey();
|
|
12437
|
-
curKey.method =
|
|
12438
|
-
curKey.url = /^blob:/.test(
|
|
12439
|
-
curKey.keyFormat =
|
|
12440
|
-
curKey.keyFormatVersions =
|
|
13151
|
+
curKey.method = _attr4.METHOD;
|
|
13152
|
+
curKey.url = /^blob:/.test(_attr4.URI) ? _attr4.URI : getAbsoluteUrl(_attr4.URI, parentUrl);
|
|
13153
|
+
curKey.keyFormat = _attr4.KEYFORMAT || "identity";
|
|
13154
|
+
curKey.keyFormatVersions = _attr4.KEYFORMATVERSIONS;
|
|
12441
13155
|
if (!curKey.isSupported()) {
|
|
12442
|
-
throw new Error("encrypt ".concat(
|
|
13156
|
+
throw new Error("encrypt ".concat(_attr4.METHOD, "/").concat(_attr4.KEYFORMAT, " is not supported"));
|
|
12443
13157
|
}
|
|
12444
|
-
if (
|
|
12445
|
-
var str =
|
|
13158
|
+
if (_attr4.IV) {
|
|
13159
|
+
var str = _attr4.IV.slice(2);
|
|
12446
13160
|
str = (str.length & 1 ? "0" : "") + str;
|
|
12447
13161
|
curKey.iv = new Uint8Array(str.length / 2);
|
|
12448
13162
|
for (var i = 0, l = str.length / 2; i < l; i++) {
|
|
@@ -12453,10 +13167,10 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12453
13167
|
break;
|
|
12454
13168
|
case "MAP":
|
|
12455
13169
|
{
|
|
12456
|
-
var
|
|
12457
|
-
curSegment.url = getAbsoluteUrl(
|
|
12458
|
-
if (
|
|
12459
|
-
curSegment.setByteRange(
|
|
13170
|
+
var _attr5 = parseAttr(data);
|
|
13171
|
+
curSegment.url = getAbsoluteUrl(_attr5.URI, parentUrl);
|
|
13172
|
+
if (_attr5.BYTERANGE)
|
|
13173
|
+
curSegment.setByteRange(_attr5.BYTERANGE);
|
|
12460
13174
|
curSegment.isInitSegment = true;
|
|
12461
13175
|
curSegment.sn = 0;
|
|
12462
13176
|
if (curKey) {
|
|
@@ -12468,24 +13182,25 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12468
13182
|
break;
|
|
12469
13183
|
case "SKIP":
|
|
12470
13184
|
{
|
|
12471
|
-
var
|
|
12472
|
-
var skippedSegments = parseInt(
|
|
13185
|
+
var _attr6 = parseAttr(data);
|
|
13186
|
+
var skippedSegments = parseInt(_attr6["SKIPPED-SEGMENTS"], 10);
|
|
12473
13187
|
if (skippedSegments <= Number.MAX_SAFE_INTEGER) {
|
|
12474
13188
|
media.skippedSegments += skippedSegments;
|
|
13189
|
+
curSN += skippedSegments;
|
|
12475
13190
|
}
|
|
12476
13191
|
}
|
|
12477
13192
|
break;
|
|
12478
13193
|
case "DATERANGE":
|
|
12479
13194
|
{
|
|
12480
|
-
var
|
|
12481
|
-
var dateRangeWithSameId = media.dateRanges[
|
|
12482
|
-
|
|
12483
|
-
var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(
|
|
13195
|
+
var _attr7 = parseAttr(data);
|
|
13196
|
+
var dateRangeWithSameId = media.dateRanges[_attr7.ID];
|
|
13197
|
+
_attr7._startDate = dateRangeWithSameId ? dateRangeWithSameId._startDate : new Date(_attr7["START-DATE"]);
|
|
13198
|
+
var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(_attr7.END_DATE);
|
|
12484
13199
|
if (Number.isFinite(endDate)) {
|
|
12485
|
-
|
|
13200
|
+
_attr7._endDate = endDate;
|
|
12486
13201
|
}
|
|
12487
|
-
if (isValidDaterange(
|
|
12488
|
-
media.dateRanges[
|
|
13202
|
+
if (isValidDaterange(_attr7, dateRangeWithSameId) || media.skippedSegments) {
|
|
13203
|
+
media.dateRanges[_attr7.ID] = _attr7;
|
|
12489
13204
|
}
|
|
12490
13205
|
}
|
|
12491
13206
|
break;
|
|
@@ -12682,6 +13397,13 @@ var ManifestLoader = /* @__PURE__ */ function() {
|
|
|
12682
13397
|
playlist
|
|
12683
13398
|
});
|
|
12684
13399
|
} else {
|
|
13400
|
+
if (this._useLowLatency) {
|
|
13401
|
+
if (playlist.canBlockReload) {
|
|
13402
|
+
this.deliveryDirectives = new HlsUrlParameters(playlist.nextSN, playlist.nextIndex, "");
|
|
13403
|
+
} else {
|
|
13404
|
+
this.deliveryDirectives = null;
|
|
13405
|
+
}
|
|
13406
|
+
}
|
|
12685
13407
|
this.hls.emit(Event$1.HLS_LEVEL_LOADED, {
|
|
12686
13408
|
playlist
|
|
12687
13409
|
});
|
|
@@ -12738,41 +13460,45 @@ var ManifestLoader = /* @__PURE__ */ function() {
|
|
|
12738
13460
|
var retryCount = this.hls.config.pollRetryCount;
|
|
12739
13461
|
var fn = /* @__PURE__ */ function() {
|
|
12740
13462
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
12741
|
-
var res;
|
|
13463
|
+
var reqUrl, res;
|
|
12742
13464
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
12743
13465
|
while (1)
|
|
12744
13466
|
switch (_context2.prev = _context2.next) {
|
|
12745
13467
|
case 0:
|
|
12746
13468
|
clearTimeout(_this2._timer);
|
|
12747
|
-
|
|
12748
|
-
_context2.
|
|
12749
|
-
|
|
12750
|
-
|
|
13469
|
+
reqUrl = url;
|
|
13470
|
+
_context2.prev = 2;
|
|
13471
|
+
if (_this2.deliveryDirectives) {
|
|
13472
|
+
reqUrl = _this2.deliveryDirectives.addDirectives(url);
|
|
13473
|
+
}
|
|
13474
|
+
_context2.next = 6;
|
|
13475
|
+
return _this2.load(reqUrl, audioUrl, subtitleUrl);
|
|
13476
|
+
case 6:
|
|
12751
13477
|
res = _context2.sent;
|
|
12752
13478
|
if (res[0]) {
|
|
12753
|
-
_context2.next =
|
|
13479
|
+
_context2.next = 9;
|
|
12754
13480
|
break;
|
|
12755
13481
|
}
|
|
12756
13482
|
return _context2.abrupt("return");
|
|
12757
|
-
case
|
|
13483
|
+
case 9:
|
|
12758
13484
|
retryCount = _this2.hls.config.pollRetryCount;
|
|
12759
13485
|
cb(res[0], res[1], res[2]);
|
|
12760
|
-
_context2.next =
|
|
13486
|
+
_context2.next = 17;
|
|
12761
13487
|
break;
|
|
12762
|
-
case
|
|
12763
|
-
_context2.prev =
|
|
12764
|
-
_context2.t0 = _context2["catch"](
|
|
13488
|
+
case 13:
|
|
13489
|
+
_context2.prev = 13;
|
|
13490
|
+
_context2.t0 = _context2["catch"](2);
|
|
12765
13491
|
retryCount--;
|
|
12766
13492
|
if (retryCount <= 0) {
|
|
12767
13493
|
errorCb(_context2.t0);
|
|
12768
13494
|
}
|
|
12769
|
-
case
|
|
13495
|
+
case 17:
|
|
12770
13496
|
_this2._timer = setTimeout(fn, time);
|
|
12771
|
-
case
|
|
13497
|
+
case 18:
|
|
12772
13498
|
case "end":
|
|
12773
13499
|
return _context2.stop();
|
|
12774
13500
|
}
|
|
12775
|
-
}, _callee2, null, [[
|
|
13501
|
+
}, _callee2, null, [[2, 13]]);
|
|
12776
13502
|
}));
|
|
12777
13503
|
return function fn2() {
|
|
12778
13504
|
return _ref2.apply(this, arguments);
|
|
@@ -13302,7 +14028,7 @@ var Playlist = /* @__PURE__ */ function() {
|
|
|
13302
14028
|
}, {
|
|
13303
14029
|
key: "clearOldSegment",
|
|
13304
14030
|
value: function clearOldSegment() {
|
|
13305
|
-
var maxPlaylistSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 50;
|
|
14031
|
+
var maxPlaylistSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.hls.config.maxPlaylistSize || 50;
|
|
13306
14032
|
var stream = this.currentStream;
|
|
13307
14033
|
if (!this.dvrWindow || !stream)
|
|
13308
14034
|
return;
|
|
@@ -13813,7 +14539,6 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13813
14539
|
return;
|
|
13814
14540
|
_this._startTick();
|
|
13815
14541
|
var media = _this.media;
|
|
13816
|
-
var buffered = Buffer$1.get(media);
|
|
13817
14542
|
var segLoaderError = _this._segmentLoader.error;
|
|
13818
14543
|
_this._onCheckQuotaExceeded();
|
|
13819
14544
|
if (_this._isProcessQuotaExceeded) {
|
|
@@ -13830,7 +14555,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13830
14555
|
}
|
|
13831
14556
|
return;
|
|
13832
14557
|
}
|
|
13833
|
-
if (
|
|
14558
|
+
if (media.readyState) {
|
|
13834
14559
|
if (isMediaPlaying(media)) {
|
|
13835
14560
|
_this._loadSegment();
|
|
13836
14561
|
if (_this._gapService) {
|
|
@@ -13896,6 +14621,12 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13896
14621
|
var _this$_bufferService;
|
|
13897
14622
|
return (_this$_bufferService = this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.baseDts;
|
|
13898
14623
|
}
|
|
14624
|
+
}, {
|
|
14625
|
+
key: "abrSwitchPoint",
|
|
14626
|
+
get: function get() {
|
|
14627
|
+
var targetSeg = this._urlSwitching ? this._playlist.currentSegment : this._playlist.nextSegment;
|
|
14628
|
+
return targetSeg ? targetSeg.start + targetSeg.duration / 2 : null;
|
|
14629
|
+
}
|
|
13899
14630
|
}, {
|
|
13900
14631
|
key: "speedInfo",
|
|
13901
14632
|
value: function speedInfo() {
|
|
@@ -13921,30 +14652,37 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13921
14652
|
}, {
|
|
13922
14653
|
key: "load",
|
|
13923
14654
|
value: function() {
|
|
13924
|
-
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee4(
|
|
13925
|
-
var reuseMse, _args4 = arguments;
|
|
14655
|
+
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee4() {
|
|
14656
|
+
var url, options, reuseMse, _args4 = arguments;
|
|
13926
14657
|
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
13927
14658
|
while (1)
|
|
13928
14659
|
switch (_context4.prev = _context4.next) {
|
|
13929
14660
|
case 0:
|
|
13930
|
-
|
|
14661
|
+
url = _args4.length > 0 && _args4[0] !== void 0 ? _args4[0] : "";
|
|
14662
|
+
options = _args4.length > 1 && _args4[1] !== void 0 ? _args4[1] : {};
|
|
14663
|
+
reuseMse = typeof options === "boolean" ? options : !!(options !== null && options !== void 0 && options.reuseMse);
|
|
14664
|
+
if (_typeof$2(options) === "object" && options !== null && options !== void 0 && options.clearSwitchStatus) {
|
|
14665
|
+
this._urlSwitching = false;
|
|
14666
|
+
this._switchUrlOpts = null;
|
|
14667
|
+
this.config.startTime = void 0;
|
|
14668
|
+
}
|
|
13931
14669
|
if (url)
|
|
13932
14670
|
this.config.url = url;
|
|
13933
14671
|
url = this.config.url;
|
|
13934
|
-
_context4.next =
|
|
14672
|
+
_context4.next = 8;
|
|
13935
14673
|
return this._reset(reuseMse);
|
|
13936
|
-
case
|
|
13937
|
-
_context4.next =
|
|
14674
|
+
case 8:
|
|
14675
|
+
_context4.next = 10;
|
|
13938
14676
|
return this._loadData(url);
|
|
13939
|
-
case
|
|
14677
|
+
case 10:
|
|
13940
14678
|
this._startTick();
|
|
13941
|
-
case
|
|
14679
|
+
case 11:
|
|
13942
14680
|
case "end":
|
|
13943
14681
|
return _context4.stop();
|
|
13944
14682
|
}
|
|
13945
14683
|
}, _callee4, this);
|
|
13946
14684
|
}));
|
|
13947
|
-
function load(
|
|
14685
|
+
function load() {
|
|
13948
14686
|
return _load.apply(this, arguments);
|
|
13949
14687
|
}
|
|
13950
14688
|
return load;
|
|
@@ -13953,7 +14691,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13953
14691
|
key: "_loadData",
|
|
13954
14692
|
value: function() {
|
|
13955
14693
|
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(url) {
|
|
13956
|
-
var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint,
|
|
14694
|
+
var manifest, currentStream, preIndex, _this$_switchUrlOpts, _this$_switchUrlOpts3, _this$_switchUrlOpts4, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, startTime, _this$_switchUrlOpts5;
|
|
13957
14695
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
13958
14696
|
while (1)
|
|
13959
14697
|
switch (_context5.prev = _context5.next) {
|
|
@@ -13974,41 +14712,46 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13974
14712
|
case 5:
|
|
13975
14713
|
manifest = _context5.sent;
|
|
13976
14714
|
currentStream = this._playlist.currentStream;
|
|
13977
|
-
if (!
|
|
13978
|
-
_context5.next =
|
|
14715
|
+
if (!this._urlSwitching) {
|
|
14716
|
+
_context5.next = 23;
|
|
13979
14717
|
break;
|
|
13980
14718
|
}
|
|
14719
|
+
if (!this.isLive) {
|
|
14720
|
+
_context5.next = 14;
|
|
14721
|
+
break;
|
|
14722
|
+
}
|
|
14723
|
+
preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
|
|
14724
|
+
logger.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
|
|
14725
|
+
if (preIndex === -1) {
|
|
14726
|
+
this._prevSegCc = null;
|
|
14727
|
+
this._prevSegSn = null;
|
|
14728
|
+
}
|
|
14729
|
+
_context5.next = 23;
|
|
14730
|
+
break;
|
|
14731
|
+
case 14:
|
|
13981
14732
|
if (currentStream.bitrate === 0 && (_this$_switchUrlOpts = this._switchUrlOpts) !== null && _this$_switchUrlOpts !== void 0 && _this$_switchUrlOpts.bitrate) {
|
|
13982
14733
|
currentStream.bitrate = (_this$_switchUrlOpts2 = this._switchUrlOpts) === null || _this$_switchUrlOpts2 === void 0 ? void 0 : _this$_switchUrlOpts2.bitrate;
|
|
13983
14734
|
}
|
|
13984
|
-
switchTimePoint = this._getSeamlessSwitchPoint();
|
|
14735
|
+
switchTimePoint = typeof ((_this$_switchUrlOpts3 = this._switchUrlOpts) === null || _this$_switchUrlOpts3 === void 0 ? void 0 : _this$_switchUrlOpts3.startTime) === "number" ? (_this$_switchUrlOpts4 = this._switchUrlOpts) === null || _this$_switchUrlOpts4 === void 0 ? void 0 : _this$_switchUrlOpts4.startTime : this._getSeamlessSwitchPoint();
|
|
13985
14736
|
this.config.startTime = switchTimePoint;
|
|
13986
14737
|
segIdx = this._playlist.findSegmentIndexByTime(switchTimePoint);
|
|
13987
14738
|
nextSeg = this._playlist.getSegmentByIndex(segIdx + 1);
|
|
13988
14739
|
if (!nextSeg) {
|
|
13989
|
-
_context5.next =
|
|
14740
|
+
_context5.next = 23;
|
|
13990
14741
|
break;
|
|
13991
14742
|
}
|
|
13992
14743
|
bufferClearStartPoint = nextSeg.start;
|
|
13993
|
-
_context5.next =
|
|
14744
|
+
_context5.next = 23;
|
|
13994
14745
|
return this._bufferService.removeBuffer(bufferClearStartPoint);
|
|
13995
|
-
case
|
|
13996
|
-
if (this._urlSwitching && this.isLive) {
|
|
13997
|
-
preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
|
|
13998
|
-
logger.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
|
|
13999
|
-
if (preIndex === -1) {
|
|
14000
|
-
this._prevSegCc = null;
|
|
14001
|
-
this._prevSegSn = null;
|
|
14002
|
-
}
|
|
14003
|
-
}
|
|
14746
|
+
case 23:
|
|
14004
14747
|
if (manifest) {
|
|
14005
|
-
_context5.next =
|
|
14748
|
+
_context5.next = 25;
|
|
14006
14749
|
break;
|
|
14007
14750
|
}
|
|
14008
14751
|
return _context5.abrupt("return");
|
|
14009
|
-
case
|
|
14752
|
+
case 25:
|
|
14010
14753
|
if (!this.isLive) {
|
|
14011
|
-
_context5.next =
|
|
14754
|
+
_context5.next = 36;
|
|
14012
14755
|
break;
|
|
14013
14756
|
}
|
|
14014
14757
|
this._bufferService.setLiveSeekableRange(0, 4294967295);
|
|
@@ -14021,35 +14764,35 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14021
14764
|
if (!manifest.isMaster)
|
|
14022
14765
|
this._pollM3U8(url);
|
|
14023
14766
|
if (!(this._playlist.nbSegments < this.config.minSegmentsStartPlay)) {
|
|
14024
|
-
_context5.next =
|
|
14767
|
+
_context5.next = 33;
|
|
14025
14768
|
break;
|
|
14026
14769
|
}
|
|
14027
14770
|
return _context5.abrupt("return");
|
|
14028
|
-
case
|
|
14029
|
-
_context5.next =
|
|
14771
|
+
case 33:
|
|
14772
|
+
_context5.next = 35;
|
|
14030
14773
|
return this._loadSegment();
|
|
14031
|
-
case
|
|
14774
|
+
case 35:
|
|
14032
14775
|
return _context5.abrupt("return");
|
|
14033
|
-
case
|
|
14034
|
-
_context5.next =
|
|
14776
|
+
case 36:
|
|
14777
|
+
_context5.next = 38;
|
|
14035
14778
|
return this._bufferService.updateDuration(currentStream.totalDuration);
|
|
14036
|
-
case
|
|
14779
|
+
case 38:
|
|
14037
14780
|
startTime = this.config.startTime;
|
|
14038
14781
|
if (startTime) {
|
|
14039
|
-
if (!((_this$
|
|
14782
|
+
if (!((_this$_switchUrlOpts5 = this._switchUrlOpts) !== null && _this$_switchUrlOpts5 !== void 0 && _this$_switchUrlOpts5.seamless)) {
|
|
14040
14783
|
this.media.currentTime = startTime;
|
|
14041
14784
|
}
|
|
14042
14785
|
this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(startTime) || 0);
|
|
14043
14786
|
}
|
|
14044
|
-
_context5.next =
|
|
14787
|
+
_context5.next = 42;
|
|
14045
14788
|
return this._loadSegment();
|
|
14046
|
-
case
|
|
14789
|
+
case 42:
|
|
14047
14790
|
case "end":
|
|
14048
14791
|
return _context5.stop();
|
|
14049
14792
|
}
|
|
14050
14793
|
}, _callee5, this);
|
|
14051
14794
|
}));
|
|
14052
|
-
function _loadData(
|
|
14795
|
+
function _loadData(_x) {
|
|
14053
14796
|
return _loadData2.apply(this, arguments);
|
|
14054
14797
|
}
|
|
14055
14798
|
return _loadData;
|
|
@@ -14063,18 +14806,20 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14063
14806
|
switch (_context6.prev = _context6.next) {
|
|
14064
14807
|
case 0:
|
|
14065
14808
|
this.config.startTime = 0;
|
|
14066
|
-
|
|
14809
|
+
this._urlSwitching = false;
|
|
14810
|
+
this._switchUrlOpts = null;
|
|
14811
|
+
_context6.next = 5;
|
|
14067
14812
|
return this.load();
|
|
14068
|
-
case
|
|
14813
|
+
case 5:
|
|
14069
14814
|
this._reloadOnPlay = false;
|
|
14070
14815
|
return _context6.abrupt("return", this.media.play(!isPlayEmit));
|
|
14071
|
-
case
|
|
14816
|
+
case 7:
|
|
14072
14817
|
case "end":
|
|
14073
14818
|
return _context6.stop();
|
|
14074
14819
|
}
|
|
14075
14820
|
}, _callee6, this);
|
|
14076
14821
|
}));
|
|
14077
|
-
function replay(
|
|
14822
|
+
function replay(_x2) {
|
|
14078
14823
|
return _replay.apply(this, arguments);
|
|
14079
14824
|
}
|
|
14080
14825
|
return replay;
|
|
@@ -14179,7 +14924,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14179
14924
|
}
|
|
14180
14925
|
}, _callee7, this, [[18, 29]]);
|
|
14181
14926
|
}));
|
|
14182
|
-
function switchURL(
|
|
14927
|
+
function switchURL(_x3) {
|
|
14183
14928
|
return _switchURL.apply(this, arguments);
|
|
14184
14929
|
}
|
|
14185
14930
|
return switchURL;
|
|
@@ -14265,7 +15010,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14265
15010
|
}
|
|
14266
15011
|
}, _callee8, this, [[8, 16], [21, 31]]);
|
|
14267
15012
|
}));
|
|
14268
|
-
function switchStream(
|
|
15013
|
+
function switchStream(_x4) {
|
|
14269
15014
|
return _switchStream.apply(this, arguments);
|
|
14270
15015
|
}
|
|
14271
15016
|
return switchStream;
|
|
@@ -14351,7 +15096,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14351
15096
|
}
|
|
14352
15097
|
}, _callee9, this, [[10, 18], [22, 32]]);
|
|
14353
15098
|
}));
|
|
14354
|
-
function switchAudioStream(
|
|
15099
|
+
function switchAudioStream(_x5) {
|
|
14355
15100
|
return _switchAudioStream.apply(this, arguments);
|
|
14356
15101
|
}
|
|
14357
15102
|
return switchAudioStream;
|
|
@@ -14376,25 +15121,50 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14376
15121
|
}
|
|
14377
15122
|
}, _callee10, this);
|
|
14378
15123
|
}));
|
|
14379
|
-
function switchSubtitleStream(
|
|
15124
|
+
function switchSubtitleStream(_x6) {
|
|
14380
15125
|
return _switchSubtitleStream.apply(this, arguments);
|
|
14381
15126
|
}
|
|
14382
15127
|
return switchSubtitleStream;
|
|
14383
15128
|
}()
|
|
14384
15129
|
}, {
|
|
14385
|
-
key: "
|
|
15130
|
+
key: "detachMedia",
|
|
14386
15131
|
value: function() {
|
|
14387
|
-
var
|
|
14388
|
-
var _this$_seiService2;
|
|
15132
|
+
var _detachMedia = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee11() {
|
|
14389
15133
|
return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
|
|
14390
15134
|
while (1)
|
|
14391
15135
|
switch (_context11.prev = _context11.next) {
|
|
15136
|
+
case 0:
|
|
15137
|
+
if (!this._bufferService) {
|
|
15138
|
+
_context11.next = 3;
|
|
15139
|
+
break;
|
|
15140
|
+
}
|
|
15141
|
+
_context11.next = 3;
|
|
15142
|
+
return this._bufferService.detachMedia();
|
|
15143
|
+
case 3:
|
|
15144
|
+
case "end":
|
|
15145
|
+
return _context11.stop();
|
|
15146
|
+
}
|
|
15147
|
+
}, _callee11, this);
|
|
15148
|
+
}));
|
|
15149
|
+
function detachMedia() {
|
|
15150
|
+
return _detachMedia.apply(this, arguments);
|
|
15151
|
+
}
|
|
15152
|
+
return detachMedia;
|
|
15153
|
+
}()
|
|
15154
|
+
}, {
|
|
15155
|
+
key: "destroy",
|
|
15156
|
+
value: function() {
|
|
15157
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee12() {
|
|
15158
|
+
var _this$_seiService2;
|
|
15159
|
+
return _regeneratorRuntime$1().wrap(function _callee12$(_context12) {
|
|
15160
|
+
while (1)
|
|
15161
|
+
switch (_context12.prev = _context12.next) {
|
|
14392
15162
|
case 0:
|
|
14393
15163
|
if (this.media) {
|
|
14394
|
-
|
|
15164
|
+
_context12.next = 2;
|
|
14395
15165
|
break;
|
|
14396
15166
|
}
|
|
14397
|
-
return
|
|
15167
|
+
return _context12.abrupt("return");
|
|
14398
15168
|
case 2:
|
|
14399
15169
|
this.removeAllListeners();
|
|
14400
15170
|
this._playlist.reset();
|
|
@@ -14405,15 +15175,15 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14405
15175
|
this.media.removeEventListener("pause", this._onPause);
|
|
14406
15176
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
14407
15177
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
14408
|
-
|
|
15178
|
+
_context12.next = 13;
|
|
14409
15179
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
14410
15180
|
case 13:
|
|
14411
15181
|
this.media = null;
|
|
14412
15182
|
case 14:
|
|
14413
15183
|
case "end":
|
|
14414
|
-
return
|
|
15184
|
+
return _context12.stop();
|
|
14415
15185
|
}
|
|
14416
|
-
},
|
|
15186
|
+
}, _callee12, this);
|
|
14417
15187
|
}));
|
|
14418
15188
|
function destroy() {
|
|
14419
15189
|
return _destroy.apply(this, arguments);
|
|
@@ -14423,48 +15193,48 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14423
15193
|
}, {
|
|
14424
15194
|
key: "_loadM3U8",
|
|
14425
15195
|
value: function() {
|
|
14426
|
-
var _loadM3U = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
15196
|
+
var _loadM3U = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee13(url) {
|
|
14427
15197
|
var playlist, _this$config$manifest, _this$config$manifest2, manifest, _ref4, _ref5, _this$_playlist$curre;
|
|
14428
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15198
|
+
return _regeneratorRuntime$1().wrap(function _callee13$(_context13) {
|
|
14429
15199
|
while (1)
|
|
14430
|
-
switch (
|
|
15200
|
+
switch (_context13.prev = _context13.next) {
|
|
14431
15201
|
case 0:
|
|
14432
|
-
|
|
15202
|
+
_context13.prev = 0;
|
|
14433
15203
|
manifest = (_this$config$manifest = this.config.manifestList) === null || _this$config$manifest === void 0 ? void 0 : (_this$config$manifest2 = _this$config$manifest.filter(function(x) {
|
|
14434
15204
|
return x.url === url;
|
|
14435
15205
|
})[0]) === null || _this$config$manifest2 === void 0 ? void 0 : _this$config$manifest2.manifest;
|
|
14436
15206
|
if (!manifest) {
|
|
14437
|
-
|
|
15207
|
+
_context13.next = 6;
|
|
14438
15208
|
break;
|
|
14439
15209
|
}
|
|
14440
|
-
|
|
14441
|
-
|
|
15210
|
+
_context13.t0 = this._manifestLoader.parseText(manifest, url);
|
|
15211
|
+
_context13.next = 9;
|
|
14442
15212
|
break;
|
|
14443
15213
|
case 6:
|
|
14444
|
-
|
|
15214
|
+
_context13.next = 8;
|
|
14445
15215
|
return this._manifestLoader.load(url);
|
|
14446
15216
|
case 8:
|
|
14447
|
-
|
|
15217
|
+
_context13.t0 = _context13.sent;
|
|
14448
15218
|
case 9:
|
|
14449
|
-
_ref4 =
|
|
15219
|
+
_ref4 = _context13.t0;
|
|
14450
15220
|
_ref5 = _slicedToArray$1(_ref4, 1);
|
|
14451
15221
|
playlist = _ref5[0];
|
|
14452
|
-
|
|
15222
|
+
_context13.next = 17;
|
|
14453
15223
|
break;
|
|
14454
15224
|
case 14:
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
throw this._emitError(StreamingError.create(
|
|
15225
|
+
_context13.prev = 14;
|
|
15226
|
+
_context13.t1 = _context13["catch"](0);
|
|
15227
|
+
throw this._emitError(StreamingError.create(_context13.t1));
|
|
14458
15228
|
case 17:
|
|
14459
15229
|
if (playlist) {
|
|
14460
|
-
|
|
15230
|
+
_context13.next = 19;
|
|
14461
15231
|
break;
|
|
14462
15232
|
}
|
|
14463
|
-
return
|
|
15233
|
+
return _context13.abrupt("return");
|
|
14464
15234
|
case 19:
|
|
14465
15235
|
this._playlist.upsertPlaylist(playlist);
|
|
14466
15236
|
if (!playlist.isMaster) {
|
|
14467
|
-
|
|
15237
|
+
_context13.next = 24;
|
|
14468
15238
|
break;
|
|
14469
15239
|
}
|
|
14470
15240
|
if ((_this$_playlist$curre = this._playlist.currentStream.subtitleStreams) !== null && _this$_playlist$curre !== void 0 && _this$_playlist$curre.length) {
|
|
@@ -14472,18 +15242,18 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14472
15242
|
list: this._playlist.currentStream.subtitleStreams
|
|
14473
15243
|
});
|
|
14474
15244
|
}
|
|
14475
|
-
|
|
15245
|
+
_context13.next = 24;
|
|
14476
15246
|
return this._refreshM3U8();
|
|
14477
15247
|
case 24:
|
|
14478
15248
|
this.emit(Event$1.STREAM_PARSED);
|
|
14479
|
-
return
|
|
15249
|
+
return _context13.abrupt("return", playlist);
|
|
14480
15250
|
case 26:
|
|
14481
15251
|
case "end":
|
|
14482
|
-
return
|
|
15252
|
+
return _context13.stop();
|
|
14483
15253
|
}
|
|
14484
|
-
},
|
|
15254
|
+
}, _callee13, this, [[0, 14]]);
|
|
14485
15255
|
}));
|
|
14486
|
-
function _loadM3U8(
|
|
15256
|
+
function _loadM3U8(_x7) {
|
|
14487
15257
|
return _loadM3U.apply(this, arguments);
|
|
14488
15258
|
}
|
|
14489
15259
|
return _loadM3U8;
|
|
@@ -14517,7 +15287,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14517
15287
|
var isEmpty = this._playlist.isEmpty;
|
|
14518
15288
|
var pollInterval;
|
|
14519
15289
|
if (this._playlist.lowLatency) {
|
|
14520
|
-
pollInterval = (this._playlist.currentStream.partTargetDuration
|
|
15290
|
+
pollInterval = (this._playlist.currentStream.partTargetDuration || 0) * 1e3;
|
|
14521
15291
|
} else {
|
|
14522
15292
|
var _this$_playlist$lastS;
|
|
14523
15293
|
pollInterval = (((_this$_playlist$lastS = this._playlist.lastSegment) === null || _this$_playlist$lastS === void 0 ? void 0 : _this$_playlist$lastS.duration) || 0) * 1e3;
|
|
@@ -14545,53 +15315,53 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14545
15315
|
}, {
|
|
14546
15316
|
key: "_loadSegmentDirect",
|
|
14547
15317
|
value: function() {
|
|
14548
|
-
var _loadSegmentDirect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
15318
|
+
var _loadSegmentDirect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee14(loadOnce) {
|
|
14549
15319
|
var seg, appended, cachedError, _this$_playlist$curre2, bufferEnd, sameStream;
|
|
14550
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15320
|
+
return _regeneratorRuntime$1().wrap(function _callee14$(_context14) {
|
|
14551
15321
|
while (1)
|
|
14552
|
-
switch (
|
|
15322
|
+
switch (_context14.prev = _context14.next) {
|
|
14553
15323
|
case 0:
|
|
14554
15324
|
seg = this._playlist.nextSegment;
|
|
14555
15325
|
if (seg) {
|
|
14556
|
-
|
|
15326
|
+
_context14.next = 3;
|
|
14557
15327
|
break;
|
|
14558
15328
|
}
|
|
14559
|
-
return
|
|
15329
|
+
return _context14.abrupt("return");
|
|
14560
15330
|
case 3:
|
|
14561
15331
|
appended = false;
|
|
14562
15332
|
cachedError = null;
|
|
14563
|
-
|
|
15333
|
+
_context14.prev = 5;
|
|
14564
15334
|
this._segmentProcessing = true;
|
|
14565
15335
|
logger.log("load segment, sn:".concat(seg.sn, ", [").concat(seg.start, ", ").concat(seg.end, "], partIndex:").concat(seg.partIndex));
|
|
14566
|
-
|
|
15336
|
+
_context14.next = 10;
|
|
14567
15337
|
return this._reqAndBufferSegment(seg, this._playlist.getAudioSegment(seg));
|
|
14568
15338
|
case 10:
|
|
14569
|
-
appended =
|
|
14570
|
-
|
|
15339
|
+
appended = _context14.sent;
|
|
15340
|
+
_context14.next = 16;
|
|
14571
15341
|
break;
|
|
14572
15342
|
case 13:
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
cachedError =
|
|
15343
|
+
_context14.prev = 13;
|
|
15344
|
+
_context14.t0 = _context14["catch"](5);
|
|
15345
|
+
cachedError = _context14.t0;
|
|
14576
15346
|
case 16:
|
|
14577
|
-
|
|
15347
|
+
_context14.prev = 16;
|
|
14578
15348
|
this._segmentProcessing = false;
|
|
14579
|
-
return
|
|
15349
|
+
return _context14.finish(16);
|
|
14580
15350
|
case 19:
|
|
14581
15351
|
if (!cachedError) {
|
|
14582
|
-
|
|
15352
|
+
_context14.next = 26;
|
|
14583
15353
|
break;
|
|
14584
15354
|
}
|
|
14585
15355
|
if (!this._bufferService.isFull()) {
|
|
14586
|
-
|
|
15356
|
+
_context14.next = 25;
|
|
14587
15357
|
break;
|
|
14588
15358
|
}
|
|
14589
15359
|
logger.log("load segment, sn:".concat(seg.sn, ", partIndex:").concat(seg.partIndex));
|
|
14590
15360
|
this._segmentProcessing = true;
|
|
14591
15361
|
this._isProcessQuotaExceeded = true;
|
|
14592
|
-
return
|
|
15362
|
+
return _context14.abrupt("return", false);
|
|
14593
15363
|
case 25:
|
|
14594
|
-
return
|
|
15364
|
+
return _context14.abrupt("return", this._emitError(StreamingError.create(cachedError)));
|
|
14595
15365
|
case 26:
|
|
14596
15366
|
if (appended) {
|
|
14597
15367
|
bufferEnd = this.bufferInfo().end;
|
|
@@ -14617,14 +15387,14 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14617
15387
|
this._loadSegment();
|
|
14618
15388
|
}
|
|
14619
15389
|
}
|
|
14620
|
-
return
|
|
15390
|
+
return _context14.abrupt("return", appended);
|
|
14621
15391
|
case 28:
|
|
14622
15392
|
case "end":
|
|
14623
|
-
return
|
|
15393
|
+
return _context14.stop();
|
|
14624
15394
|
}
|
|
14625
|
-
},
|
|
15395
|
+
}, _callee14, this, [[5, 13, 16, 19]]);
|
|
14626
15396
|
}));
|
|
14627
|
-
function _loadSegmentDirect(
|
|
15397
|
+
function _loadSegmentDirect(_x8) {
|
|
14628
15398
|
return _loadSegmentDirect2.apply(this, arguments);
|
|
14629
15399
|
}
|
|
14630
15400
|
return _loadSegmentDirect;
|
|
@@ -14632,45 +15402,45 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14632
15402
|
}, {
|
|
14633
15403
|
key: "_reqAndBufferSegment",
|
|
14634
15404
|
value: function() {
|
|
14635
|
-
var _reqAndBufferSegment2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
15405
|
+
var _reqAndBufferSegment2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee15(seg, audioSeg) {
|
|
14636
15406
|
var _this$_bufferService2;
|
|
14637
15407
|
var cc, discontinuity, responses, data, sn, start, stream, before, contiguous, segStart;
|
|
14638
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15408
|
+
return _regeneratorRuntime$1().wrap(function _callee15$(_context15) {
|
|
14639
15409
|
while (1)
|
|
14640
|
-
switch (
|
|
15410
|
+
switch (_context15.prev = _context15.next) {
|
|
14641
15411
|
case 0:
|
|
14642
15412
|
cc = seg ? seg.cc : audioSeg.cc;
|
|
14643
15413
|
discontinuity = this._prevSegCc !== cc;
|
|
14644
15414
|
responses = [];
|
|
14645
|
-
|
|
14646
|
-
|
|
15415
|
+
_context15.prev = 3;
|
|
15416
|
+
_context15.next = 6;
|
|
14647
15417
|
return this._segmentLoader.load(seg, audioSeg, discontinuity);
|
|
14648
15418
|
case 6:
|
|
14649
|
-
responses =
|
|
14650
|
-
|
|
15419
|
+
responses = _context15.sent;
|
|
15420
|
+
_context15.next = 14;
|
|
14651
15421
|
break;
|
|
14652
15422
|
case 9:
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
this._segmentLoader.error =
|
|
14657
|
-
throw
|
|
15423
|
+
_context15.prev = 9;
|
|
15424
|
+
_context15.t0 = _context15["catch"](3);
|
|
15425
|
+
_context15.t0.fatal = false;
|
|
15426
|
+
this._segmentLoader.error = _context15.t0;
|
|
15427
|
+
throw _context15.t0;
|
|
14658
15428
|
case 14:
|
|
14659
15429
|
if (responses[0]) {
|
|
14660
|
-
|
|
15430
|
+
_context15.next = 16;
|
|
14661
15431
|
break;
|
|
14662
15432
|
}
|
|
14663
|
-
return
|
|
15433
|
+
return _context15.abrupt("return");
|
|
14664
15434
|
case 16:
|
|
14665
|
-
|
|
15435
|
+
_context15.next = 18;
|
|
14666
15436
|
return (_this$_bufferService2 = this._bufferService).decryptBuffer.apply(_this$_bufferService2, _toConsumableArray$2(responses));
|
|
14667
15437
|
case 18:
|
|
14668
|
-
data =
|
|
15438
|
+
data = _context15.sent;
|
|
14669
15439
|
if (data) {
|
|
14670
|
-
|
|
15440
|
+
_context15.next = 21;
|
|
14671
15441
|
break;
|
|
14672
15442
|
}
|
|
14673
|
-
return
|
|
15443
|
+
return _context15.abrupt("return");
|
|
14674
15444
|
case 21:
|
|
14675
15445
|
sn = seg ? seg.sn : audioSeg.sn;
|
|
14676
15446
|
start = seg ? seg.start : audioSeg.start;
|
|
@@ -14684,26 +15454,26 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14684
15454
|
logger.warn("update the new playlist liveEdge, segment id=".concat(sn, ", buffer start=").concat(segStart, ", liveEdge=").concat(this._playlist.liveEdge));
|
|
14685
15455
|
start = segStart;
|
|
14686
15456
|
}
|
|
14687
|
-
|
|
15457
|
+
_context15.next = 30;
|
|
14688
15458
|
return this._bufferService.appendBuffer(seg, audioSeg, data[0], data[1], discontinuity, contiguous, start);
|
|
14689
15459
|
case 30:
|
|
14690
15460
|
this.emit(Event$1.APPEND_COST, {
|
|
14691
15461
|
elapsed: Date.now() - before,
|
|
14692
15462
|
url: seg.url
|
|
14693
15463
|
});
|
|
14694
|
-
|
|
15464
|
+
_context15.next = 33;
|
|
14695
15465
|
return this._bufferService.evictBuffer(this.config.bufferBehind);
|
|
14696
15466
|
case 33:
|
|
14697
15467
|
this._prevSegCc = cc;
|
|
14698
15468
|
this._prevSegSn = sn;
|
|
14699
|
-
return
|
|
15469
|
+
return _context15.abrupt("return", true);
|
|
14700
15470
|
case 36:
|
|
14701
15471
|
case "end":
|
|
14702
|
-
return
|
|
15472
|
+
return _context15.stop();
|
|
14703
15473
|
}
|
|
14704
|
-
},
|
|
15474
|
+
}, _callee15, this, [[3, 9]]);
|
|
14705
15475
|
}));
|
|
14706
|
-
function _reqAndBufferSegment(
|
|
15476
|
+
function _reqAndBufferSegment(_x9, _x10) {
|
|
14707
15477
|
return _reqAndBufferSegment2.apply(this, arguments);
|
|
14708
15478
|
}
|
|
14709
15479
|
return _reqAndBufferSegment;
|
|
@@ -14711,11 +15481,11 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14711
15481
|
}, {
|
|
14712
15482
|
key: "_onCheckQuotaExceeded",
|
|
14713
15483
|
value: function() {
|
|
14714
|
-
var _onCheckQuotaExceeded2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
15484
|
+
var _onCheckQuotaExceeded2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee16() {
|
|
14715
15485
|
var seekTime, buffered, inBuffered, i, bufferBehind, mediaTime;
|
|
14716
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15486
|
+
return _regeneratorRuntime$1().wrap(function _callee16$(_context16) {
|
|
14717
15487
|
while (1)
|
|
14718
|
-
switch (
|
|
15488
|
+
switch (_context16.prev = _context16.next) {
|
|
14719
15489
|
case 0:
|
|
14720
15490
|
seekTime = this.media.currentTime;
|
|
14721
15491
|
buffered = this.media.buffered;
|
|
@@ -14723,37 +15493,37 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14723
15493
|
i = 0;
|
|
14724
15494
|
case 4:
|
|
14725
15495
|
if (!(i < buffered.length)) {
|
|
14726
|
-
|
|
15496
|
+
_context16.next = 11;
|
|
14727
15497
|
break;
|
|
14728
15498
|
}
|
|
14729
15499
|
if (!(buffered.start(0) >= seekTime && seekTime < buffered.end(i))) {
|
|
14730
|
-
|
|
15500
|
+
_context16.next = 8;
|
|
14731
15501
|
break;
|
|
14732
15502
|
}
|
|
14733
15503
|
inBuffered = true;
|
|
14734
|
-
return
|
|
15504
|
+
return _context16.abrupt("break", 11);
|
|
14735
15505
|
case 8:
|
|
14736
15506
|
i++;
|
|
14737
|
-
|
|
15507
|
+
_context16.next = 4;
|
|
14738
15508
|
break;
|
|
14739
15509
|
case 11:
|
|
14740
15510
|
if (!this._bufferService.isFull()) {
|
|
14741
|
-
|
|
15511
|
+
_context16.next = 17;
|
|
14742
15512
|
break;
|
|
14743
15513
|
}
|
|
14744
15514
|
bufferBehind = inBuffered ? this.config.bufferBehind : 5;
|
|
14745
15515
|
mediaTime = this.media.currentTime;
|
|
14746
15516
|
if (!(mediaTime - bufferBehind > 0)) {
|
|
14747
|
-
|
|
15517
|
+
_context16.next = 17;
|
|
14748
15518
|
break;
|
|
14749
15519
|
}
|
|
14750
|
-
|
|
15520
|
+
_context16.next = 17;
|
|
14751
15521
|
return this._bufferService.removeBuffer(0, mediaTime - bufferBehind);
|
|
14752
15522
|
case 17:
|
|
14753
15523
|
case "end":
|
|
14754
|
-
return
|
|
15524
|
+
return _context16.stop();
|
|
14755
15525
|
}
|
|
14756
|
-
},
|
|
15526
|
+
}, _callee16, this);
|
|
14757
15527
|
}));
|
|
14758
15528
|
function _onCheckQuotaExceeded() {
|
|
14759
15529
|
return _onCheckQuotaExceeded2.apply(this, arguments);
|
|
@@ -14771,22 +15541,22 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14771
15541
|
}, {
|
|
14772
15542
|
key: "_clear",
|
|
14773
15543
|
value: function() {
|
|
14774
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
14775
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15544
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee17() {
|
|
15545
|
+
return _regeneratorRuntime$1().wrap(function _callee17$(_context17) {
|
|
14776
15546
|
while (1)
|
|
14777
|
-
switch (
|
|
15547
|
+
switch (_context17.prev = _context17.next) {
|
|
14778
15548
|
case 0:
|
|
14779
15549
|
clearTimeout(this._disconnectTimer);
|
|
14780
15550
|
this._stopTick();
|
|
14781
|
-
|
|
15551
|
+
_context17.next = 4;
|
|
14782
15552
|
return Promise.all([this._segmentLoader.cancel(), this._manifestLoader.stopPoll()]);
|
|
14783
15553
|
case 4:
|
|
14784
15554
|
this._segmentProcessing = false;
|
|
14785
15555
|
case 5:
|
|
14786
15556
|
case "end":
|
|
14787
|
-
return
|
|
15557
|
+
return _context17.stop();
|
|
14788
15558
|
}
|
|
14789
|
-
},
|
|
15559
|
+
}, _callee17, this);
|
|
14790
15560
|
}));
|
|
14791
15561
|
function _clear() {
|
|
14792
15562
|
return _clear2.apply(this, arguments);
|
|
@@ -14796,14 +15566,14 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14796
15566
|
}, {
|
|
14797
15567
|
key: "_reset",
|
|
14798
15568
|
value: function() {
|
|
14799
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
15569
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee18() {
|
|
14800
15570
|
var _this$_seiService3;
|
|
14801
|
-
var reuseMse,
|
|
14802
|
-
return _regeneratorRuntime$1().wrap(function
|
|
15571
|
+
var reuseMse, _args18 = arguments;
|
|
15572
|
+
return _regeneratorRuntime$1().wrap(function _callee18$(_context18) {
|
|
14803
15573
|
while (1)
|
|
14804
|
-
switch (
|
|
15574
|
+
switch (_context18.prev = _context18.next) {
|
|
14805
15575
|
case 0:
|
|
14806
|
-
reuseMse =
|
|
15576
|
+
reuseMse = _args18.length > 0 && _args18[0] !== void 0 ? _args18[0] : false;
|
|
14807
15577
|
this._reloadOnPlay = false;
|
|
14808
15578
|
this._prevSegSn = null;
|
|
14809
15579
|
this._prevSegCc = null;
|
|
@@ -14812,15 +15582,15 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14812
15582
|
this._segmentLoader.reset();
|
|
14813
15583
|
(_this$_seiService3 = this._seiService) === null || _this$_seiService3 === void 0 ? void 0 : _this$_seiService3.reset();
|
|
14814
15584
|
this._stats.reset();
|
|
14815
|
-
|
|
15585
|
+
_context18.next = 11;
|
|
14816
15586
|
return this._clear();
|
|
14817
15587
|
case 11:
|
|
14818
|
-
return
|
|
15588
|
+
return _context18.abrupt("return", this._bufferService.reset(reuseMse));
|
|
14819
15589
|
case 12:
|
|
14820
15590
|
case "end":
|
|
14821
|
-
return
|
|
15591
|
+
return _context18.stop();
|
|
14822
15592
|
}
|
|
14823
|
-
},
|
|
15593
|
+
}, _callee18, this);
|
|
14824
15594
|
}));
|
|
14825
15595
|
function _reset() {
|
|
14826
15596
|
return _reset2.apply(this, arguments);
|
|
@@ -14938,7 +15708,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14938
15708
|
}]);
|
|
14939
15709
|
return Hls2;
|
|
14940
15710
|
}(EventEmitter);
|
|
14941
|
-
_defineProperty$3(Hls, "version", "3.0.
|
|
15711
|
+
_defineProperty$3(Hls, "version", "3.0.21-rc.2");
|
|
14942
15712
|
try {
|
|
14943
15713
|
if (localStorage.getItem("xgd")) {
|
|
14944
15714
|
Hls.enableLogger();
|
|
@@ -15029,6 +15799,7 @@ var PluginExtension = /* @__PURE__ */ function() {
|
|
|
15029
15799
|
}]);
|
|
15030
15800
|
return PluginExtension2;
|
|
15031
15801
|
}();
|
|
15802
|
+
var _excluded = ["currentTime"];
|
|
15032
15803
|
function parseSwitchUrlArgs(args, plugin) {
|
|
15033
15804
|
var player = plugin.player;
|
|
15034
15805
|
var curTime = player.currentTime;
|
|
@@ -15039,9 +15810,14 @@ function parseSwitchUrlArgs(args, plugin) {
|
|
|
15039
15810
|
case "boolean":
|
|
15040
15811
|
options.seamless = args;
|
|
15041
15812
|
break;
|
|
15042
|
-
case "object":
|
|
15043
|
-
|
|
15813
|
+
case "object": {
|
|
15814
|
+
var currentTime = args.currentTime, rest = _objectWithoutProperties$1(args, _excluded);
|
|
15815
|
+
Object.assign(options, rest);
|
|
15816
|
+
if (typeof currentTime === "number") {
|
|
15817
|
+
options.startTime = currentTime;
|
|
15818
|
+
}
|
|
15044
15819
|
break;
|
|
15820
|
+
}
|
|
15045
15821
|
}
|
|
15046
15822
|
return options;
|
|
15047
15823
|
}
|
|
@@ -15051,10 +15827,11 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15051
15827
|
function HlsPlugin2() {
|
|
15052
15828
|
var _this;
|
|
15053
15829
|
_classCallCheck$3(this, HlsPlugin2);
|
|
15054
|
-
for (var _len = arguments.length,
|
|
15055
|
-
|
|
15830
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15831
|
+
args[_key] = arguments[_key];
|
|
15056
15832
|
}
|
|
15057
|
-
_this = _super.call.apply(_super, [this].concat(
|
|
15833
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
15834
|
+
_defineProperty$3(_assertThisInitialized$2(_this), "logger", logger);
|
|
15058
15835
|
_defineProperty$3(_assertThisInitialized$2(_this), "hls", null);
|
|
15059
15836
|
_defineProperty$3(_assertThisInitialized$2(_this), "pluginExtension", null);
|
|
15060
15837
|
_defineProperty$3(_assertThisInitialized$2(_this), "getStats", function() {
|
|
@@ -15066,24 +15843,6 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15066
15843
|
var lang = _ref.lang;
|
|
15067
15844
|
(_this$hls2 = _this.hls) === null || _this$hls2 === void 0 ? void 0 : _this$hls2.switchSubtitleStream(lang);
|
|
15068
15845
|
});
|
|
15069
|
-
_defineProperty$3(_assertThisInitialized$2(_this), "_onSwitchURL", function(url, args) {
|
|
15070
|
-
return new Promise(function(resolve, reject) {
|
|
15071
|
-
var _assertThisInitialize = _assertThisInitialized$2(_this), player = _assertThisInitialize.player, hls = _assertThisInitialize.hls;
|
|
15072
|
-
if (hls) {
|
|
15073
|
-
var _this$player$config, _this$player$config$h;
|
|
15074
|
-
var options = parseSwitchUrlArgs(args, _assertThisInitialized$2(_this));
|
|
15075
|
-
player.config.url = url;
|
|
15076
|
-
hls.switchURL(url, options).then(function() {
|
|
15077
|
-
return resolve(true);
|
|
15078
|
-
}).catch(reject);
|
|
15079
|
-
if (!options.seamless && (_this$player$config = _this.player.config) !== null && _this$player$config !== void 0 && (_this$player$config$h = _this$player$config.hls) !== null && _this$player$config$h !== void 0 && _this$player$config$h.keepStatusAfterSwitch) {
|
|
15080
|
-
_this._keepPauseStatus();
|
|
15081
|
-
}
|
|
15082
|
-
} else {
|
|
15083
|
-
reject();
|
|
15084
|
-
}
|
|
15085
|
-
});
|
|
15086
|
-
});
|
|
15087
15846
|
_defineProperty$3(_assertThisInitialized$2(_this), "_keepPauseStatus", function() {
|
|
15088
15847
|
var paused = _this.player.paused;
|
|
15089
15848
|
if (!paused)
|
|
@@ -15108,8 +15867,8 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15108
15867
|
}, {
|
|
15109
15868
|
key: "softDecode",
|
|
15110
15869
|
get: function get() {
|
|
15111
|
-
var _this$player, _this$player$
|
|
15112
|
-
var mediaType = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : (_this$player$
|
|
15870
|
+
var _this$player, _this$player$config;
|
|
15871
|
+
var mediaType = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : (_this$player$config = _this$player.config) === null || _this$player$config === void 0 ? void 0 : _this$player$config.mediaType;
|
|
15113
15872
|
return !!mediaType && mediaType !== "video" && mediaType !== "audio";
|
|
15114
15873
|
}
|
|
15115
15874
|
}, {
|
|
@@ -15117,13 +15876,35 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15117
15876
|
value: function beforePlayerInit() {
|
|
15118
15877
|
var _this2 = this;
|
|
15119
15878
|
var config = this.player.config;
|
|
15879
|
+
var mediaElem = this.player.media || this.player.video;
|
|
15120
15880
|
var hlsOpts = config.hls || {};
|
|
15121
15881
|
if (!config.url && !config.__allowHlsEmptyUrl__ || !hlsOpts.preferMMS && MSE.isMMSOnly()) {
|
|
15122
15882
|
return;
|
|
15123
15883
|
}
|
|
15124
15884
|
if (this.hls)
|
|
15125
15885
|
this.hls.destroy();
|
|
15126
|
-
|
|
15886
|
+
var descriptor = Object.getOwnPropertyDescriptor(this.player, "switchURL");
|
|
15887
|
+
if (!descriptor || descriptor.writable) {
|
|
15888
|
+
this.player.switchURL = function(url, args) {
|
|
15889
|
+
return new Promise(function(resolve, reject) {
|
|
15890
|
+
var player = _this2.player, hls = _this2.hls;
|
|
15891
|
+
if (hls) {
|
|
15892
|
+
var _this2$player$config, _this2$player$config$;
|
|
15893
|
+
var options = parseSwitchUrlArgs(args, _this2);
|
|
15894
|
+
player.config.url = url;
|
|
15895
|
+
hls.switchURL(url, options).then(function() {
|
|
15896
|
+
return resolve(true);
|
|
15897
|
+
}).catch(reject);
|
|
15898
|
+
if (!options.seamless && (_this2$player$config = _this2.player.config) !== null && _this2$player$config !== void 0 && (_this2$player$config$ = _this2$player$config.hls) !== null && _this2$player$config$ !== void 0 && _this2$player$config$.keepStatusAfterSwitch) {
|
|
15899
|
+
_this2._keepPauseStatus();
|
|
15900
|
+
}
|
|
15901
|
+
} else {
|
|
15902
|
+
reject();
|
|
15903
|
+
}
|
|
15904
|
+
});
|
|
15905
|
+
};
|
|
15906
|
+
}
|
|
15907
|
+
var onSwitchUrl = this.player.switchURL;
|
|
15127
15908
|
this.player.handleSource = false;
|
|
15128
15909
|
hlsOpts.innerDegrade = hlsOpts.innerDegrade || config.innerDegrade;
|
|
15129
15910
|
if (hlsOpts.disconnectTime === null || hlsOpts.disconnectTime === void 0)
|
|
@@ -15131,7 +15912,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15131
15912
|
this.hls = new Hls(_objectSpread2$2({
|
|
15132
15913
|
softDecode: this.softDecode,
|
|
15133
15914
|
isLive: config.isLive,
|
|
15134
|
-
media:
|
|
15915
|
+
media: mediaElem,
|
|
15135
15916
|
startTime: config.startTime,
|
|
15136
15917
|
url: config.url
|
|
15137
15918
|
}, hlsOpts));
|
|
@@ -15149,7 +15930,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15149
15930
|
if (this.softDecode) {
|
|
15150
15931
|
this.pluginExtension = new PluginExtension(_objectSpread2$2({
|
|
15151
15932
|
isLive: config.isLive,
|
|
15152
|
-
media:
|
|
15933
|
+
media: mediaElem
|
|
15153
15934
|
}, hlsOpts), this);
|
|
15154
15935
|
this.player.forceDegradeToVideo = function() {
|
|
15155
15936
|
var _this2$pluginExtensio;
|
|
@@ -15166,8 +15947,8 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15166
15947
|
return (_this2$hls2 = _this2.hls) === null || _this2$hls2 === void 0 ? void 0 : _this2$hls2.replay();
|
|
15167
15948
|
});
|
|
15168
15949
|
}
|
|
15950
|
+
this.on(URL_CHANGE, onSwitchUrl);
|
|
15169
15951
|
this.on(SWITCH_SUBTITLE, this._onSwitchSubtitle);
|
|
15170
|
-
this.on(URL_CHANGE, this._onSwitchURL);
|
|
15171
15952
|
this.on(DESTROY, this.destroy.bind(this));
|
|
15172
15953
|
this._transError();
|
|
15173
15954
|
this._transCoreEvent(EVENT.TTFB);
|
|
@@ -15177,6 +15958,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15177
15958
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
15178
15959
|
this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED);
|
|
15179
15960
|
this._transCoreEvent(EVENT.MEDIASOURCE_OPENED);
|
|
15961
|
+
this._transCoreEvent(EVENT.APPEND_BUFFER);
|
|
15180
15962
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
15181
15963
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
15182
15964
|
this._transCoreEvent(EVENT.KEYFRAME);
|
|
@@ -15196,7 +15978,9 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
15196
15978
|
this._transCoreEvent(Event$1.SUBTITLE_PLAYLIST);
|
|
15197
15979
|
this._transCoreEvent(Event$1.APPEND_COST);
|
|
15198
15980
|
if (config.url) {
|
|
15199
|
-
this.hls.load(config.url,
|
|
15981
|
+
this.hls.load(config.url, {
|
|
15982
|
+
reuseMse: true
|
|
15983
|
+
}).catch(function(e) {
|
|
15200
15984
|
});
|
|
15201
15985
|
}
|
|
15202
15986
|
}
|