@byteplus/veplayer-plugin 2.3.1-rc.2 → 2.4.0-rc.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.js +20274 -35966
- package/esm/index.production.js +5 -5
- package/esm/veplayer.plugin.flv.development.js +281 -178
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +656 -261
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/package.json +21 -1
- package/umd/index.d.ts +0 -1
- package/umd/veplayer.plugin.flv.development.js +277 -174
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +650 -255
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.drm.development.js +0 -1577
- package/esm/veplayer.plugin.drm.production.js +0 -2
- package/esm/veplayer.plugin.mp4.development.js +0 -38039
- package/esm/veplayer.plugin.mp4.production.js +0 -2
- package/esm/veplayer.plugin.rtm.development.js +0 -5587
- package/esm/veplayer.plugin.rtm.production.js +0 -2
- package/esm/veplayer.plugin.shaka.development.js +0 -15973
- package/esm/veplayer.plugin.shaka.production.js +0 -20
- package/esm/veplayer.plugin.time.shift.development.css +0 -63
- package/esm/veplayer.plugin.time.shift.development.js +0 -339
- package/esm/veplayer.plugin.time.shift.production.css +0 -1
- package/esm/veplayer.plugin.time.shift.production.js +0 -2
- package/esm/veplayer.plugin.xgvideo.development.js +0 -19097
- package/esm/veplayer.plugin.xgvideo.production.js +0 -2
- package/umd/veplayer.plugin.drm.development.js +0 -1579
- package/umd/veplayer.plugin.drm.production.js +0 -1
- package/umd/veplayer.plugin.mp4.development.js +0 -38043
- package/umd/veplayer.plugin.mp4.production.js +0 -1
- package/umd/veplayer.plugin.rtm.development.js +0 -5589
- package/umd/veplayer.plugin.rtm.production.js +0 -1
- package/umd/veplayer.plugin.shaka.development.js +0 -15977
- package/umd/veplayer.plugin.shaka.production.js +0 -1
- package/umd/veplayer.plugin.time.shift.development.css +0 -63
- package/umd/veplayer.plugin.time.shift.development.js +0 -342
- package/umd/veplayer.plugin.time.shift.production.css +0 -1
- package/umd/veplayer.plugin.time.shift.production.js +0 -1
- package/umd/veplayer.plugin.xgvideo.development.js +0 -19099
- package/umd/veplayer.plugin.xgvideo.production.js +0 -1
|
@@ -482,6 +482,38 @@ function _isNativeReflectConstruct$2() {
|
|
|
482
482
|
return false;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
486
|
+
if (source == null)
|
|
487
|
+
return {};
|
|
488
|
+
var target = {};
|
|
489
|
+
var sourceKeys = Object.keys(source);
|
|
490
|
+
var key, i;
|
|
491
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
492
|
+
key = sourceKeys[i];
|
|
493
|
+
if (excluded.indexOf(key) >= 0)
|
|
494
|
+
continue;
|
|
495
|
+
target[key] = source[key];
|
|
496
|
+
}
|
|
497
|
+
return target;
|
|
498
|
+
}
|
|
499
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
500
|
+
if (source == null)
|
|
501
|
+
return {};
|
|
502
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
503
|
+
var key, i;
|
|
504
|
+
if (Object.getOwnPropertySymbols) {
|
|
505
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
506
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
507
|
+
key = sourceSymbolKeys[i];
|
|
508
|
+
if (excluded.indexOf(key) >= 0)
|
|
509
|
+
continue;
|
|
510
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
511
|
+
continue;
|
|
512
|
+
target[key] = source[key];
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return target;
|
|
516
|
+
}
|
|
485
517
|
function _assertThisInitialized$2(self) {
|
|
486
518
|
if (self === void 0) {
|
|
487
519
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -1457,6 +1489,9 @@ util.cancelAnimationFrame = function(frameId) {
|
|
|
1457
1489
|
_fun && _fun(frameId);
|
|
1458
1490
|
};
|
|
1459
1491
|
util.isMSE = function(video) {
|
|
1492
|
+
if (video.media) {
|
|
1493
|
+
video = video.media;
|
|
1494
|
+
}
|
|
1460
1495
|
if (!video || !(video instanceof HTMLMediaElement)) {
|
|
1461
1496
|
return false;
|
|
1462
1497
|
}
|
|
@@ -1605,7 +1640,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1605
1640
|
}
|
|
1606
1641
|
return offsetTime;
|
|
1607
1642
|
};
|
|
1608
|
-
var version = "3.0.
|
|
1643
|
+
var version = "3.0.17";
|
|
1609
1644
|
var ERROR_MAP = {
|
|
1610
1645
|
1: 5101,
|
|
1611
1646
|
2: 5102,
|
|
@@ -2709,30 +2744,6 @@ function _toPropertyKey$1(arg) {
|
|
|
2709
2744
|
var key = _toPrimitive$1(arg, "string");
|
|
2710
2745
|
return typeof key === "symbol" ? key : String(key);
|
|
2711
2746
|
}
|
|
2712
|
-
function createPublicPromise() {
|
|
2713
|
-
var res, rej;
|
|
2714
|
-
var promise = new Promise(function(resolve, reject) {
|
|
2715
|
-
res = resolve;
|
|
2716
|
-
rej = reject;
|
|
2717
|
-
});
|
|
2718
|
-
promise.used = false;
|
|
2719
|
-
promise.resolve = function() {
|
|
2720
|
-
promise.used = true;
|
|
2721
|
-
return res.apply(void 0, arguments);
|
|
2722
|
-
};
|
|
2723
|
-
promise.reject = function() {
|
|
2724
|
-
promise.used = true;
|
|
2725
|
-
return rej.apply(void 0, arguments);
|
|
2726
|
-
};
|
|
2727
|
-
return promise;
|
|
2728
|
-
}
|
|
2729
|
-
function nowTime$1() {
|
|
2730
|
-
try {
|
|
2731
|
-
return parseInt(performance.now(), 10);
|
|
2732
|
-
} catch (e) {
|
|
2733
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
2747
|
var Buffer$1 = /* @__PURE__ */ function() {
|
|
2737
2748
|
function Buffer2() {
|
|
2738
2749
|
_classCallCheck$1(this, Buffer2);
|
|
@@ -2854,6 +2865,7 @@ var Buffer$1 = /* @__PURE__ */ function() {
|
|
|
2854
2865
|
}]);
|
|
2855
2866
|
return Buffer2;
|
|
2856
2867
|
}();
|
|
2868
|
+
var isBrowser$1 = typeof window !== "undefined";
|
|
2857
2869
|
var _ERR_CODE;
|
|
2858
2870
|
var ERR = {
|
|
2859
2871
|
MANIFEST: "manifest",
|
|
@@ -2972,7 +2984,6 @@ var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
|
2972
2984
|
}]);
|
|
2973
2985
|
return StreamingError2;
|
|
2974
2986
|
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
2975
|
-
var isBrowser$1 = typeof window !== "undefined";
|
|
2976
2987
|
var LogCacheLevel = {
|
|
2977
2988
|
"DEBUG": 1,
|
|
2978
2989
|
"LOG": 2,
|
|
@@ -3001,7 +3012,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3001
3012
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
3002
3013
|
if (Logger2.disabled)
|
|
3003
3014
|
return;
|
|
3004
|
-
(_console = console).debug.apply(_console, [this._prefix, nowTime()].concat(args));
|
|
3015
|
+
(_console = console).debug.apply(_console, [this._prefix, nowTime$1()].concat(args));
|
|
3005
3016
|
}
|
|
3006
3017
|
}, {
|
|
3007
3018
|
key: "log",
|
|
@@ -3013,7 +3024,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3013
3024
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
3014
3025
|
if (Logger2.disabled)
|
|
3015
3026
|
return;
|
|
3016
|
-
(_console2 = console).log.apply(_console2, [this._prefix, nowTime()].concat(args));
|
|
3027
|
+
(_console2 = console).log.apply(_console2, [this._prefix, nowTime$1()].concat(args));
|
|
3017
3028
|
}
|
|
3018
3029
|
}, {
|
|
3019
3030
|
key: "warn",
|
|
@@ -3025,7 +3036,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3025
3036
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
3026
3037
|
if (Logger2.disabled)
|
|
3027
3038
|
return;
|
|
3028
|
-
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime()].concat(args));
|
|
3039
|
+
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime$1()].concat(args));
|
|
3029
3040
|
}
|
|
3030
3041
|
}, {
|
|
3031
3042
|
key: "error",
|
|
@@ -3037,7 +3048,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3037
3048
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
3038
3049
|
if (Logger2.disabled)
|
|
3039
3050
|
return;
|
|
3040
|
-
(_console4 = console).error.apply(_console4, [this._prefix, nowTime()].concat(args));
|
|
3051
|
+
(_console4 = console).error.apply(_console4, [this._prefix, nowTime$1()].concat(args));
|
|
3041
3052
|
}
|
|
3042
3053
|
}, {
|
|
3043
3054
|
key: "logCache",
|
|
@@ -3052,7 +3063,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3052
3063
|
var finLogText = logText.map(function(item) {
|
|
3053
3064
|
return logable(item);
|
|
3054
3065
|
});
|
|
3055
|
-
text = this._prefix + nowTime() + JSON.stringify(finLogText);
|
|
3066
|
+
text = this._prefix + nowTime$1() + JSON.stringify(finLogText);
|
|
3056
3067
|
} catch (e) {
|
|
3057
3068
|
return;
|
|
3058
3069
|
}
|
|
@@ -3107,7 +3118,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3107
3118
|
return Logger2;
|
|
3108
3119
|
}();
|
|
3109
3120
|
_defineProperty$1(Logger$2, "disabled", true);
|
|
3110
|
-
function nowTime() {
|
|
3121
|
+
function nowTime$1() {
|
|
3111
3122
|
return (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3112
3123
|
}
|
|
3113
3124
|
function reduceDepth(val) {
|
|
@@ -3155,13 +3166,72 @@ function logable(obj, maxDepth, depth) {
|
|
|
3155
3166
|
}
|
|
3156
3167
|
return result;
|
|
3157
3168
|
}
|
|
3169
|
+
function createPublicPromise() {
|
|
3170
|
+
var res, rej;
|
|
3171
|
+
var promise = new Promise(function(resolve, reject) {
|
|
3172
|
+
res = resolve;
|
|
3173
|
+
rej = reject;
|
|
3174
|
+
});
|
|
3175
|
+
promise.used = false;
|
|
3176
|
+
promise.resolve = function() {
|
|
3177
|
+
promise.used = true;
|
|
3178
|
+
return res.apply(void 0, arguments);
|
|
3179
|
+
};
|
|
3180
|
+
promise.reject = function() {
|
|
3181
|
+
promise.used = true;
|
|
3182
|
+
return rej.apply(void 0, arguments);
|
|
3183
|
+
};
|
|
3184
|
+
return promise;
|
|
3185
|
+
}
|
|
3186
|
+
function nowTime() {
|
|
3187
|
+
try {
|
|
3188
|
+
return parseInt(performance.now(), 10);
|
|
3189
|
+
} catch (e) {
|
|
3190
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
var SafeJSON = {
|
|
3194
|
+
stringify: function stringify(obj) {
|
|
3195
|
+
try {
|
|
3196
|
+
return JSON.stringify(obj);
|
|
3197
|
+
} catch (e) {
|
|
3198
|
+
return "";
|
|
3199
|
+
}
|
|
3200
|
+
},
|
|
3201
|
+
parse: function parse(obj) {
|
|
3202
|
+
try {
|
|
3203
|
+
return JSON.parse(obj);
|
|
3204
|
+
} catch (e) {
|
|
3205
|
+
return void 0;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3158
3209
|
function getMediaSource() {
|
|
3210
|
+
var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3159
3211
|
try {
|
|
3160
|
-
|
|
3212
|
+
if (!isBrowser$1)
|
|
3213
|
+
return null;
|
|
3214
|
+
if (preferMMS && typeof ManagedMediaSource !== "undefined")
|
|
3215
|
+
return ManagedMediaSource;
|
|
3216
|
+
return window.MediaSource;
|
|
3161
3217
|
} catch (e) {
|
|
3162
3218
|
}
|
|
3163
3219
|
}
|
|
3164
|
-
|
|
3220
|
+
function isMMS(mediaSource) {
|
|
3221
|
+
return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
|
|
3222
|
+
}
|
|
3223
|
+
function getTimeRanges(buffered) {
|
|
3224
|
+
var ranges = [];
|
|
3225
|
+
if (buffered instanceof TimeRanges) {
|
|
3226
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
3227
|
+
ranges.push({
|
|
3228
|
+
start: buffered.start(i),
|
|
3229
|
+
end: buffered.end(i)
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
return ranges;
|
|
3234
|
+
}
|
|
3165
3235
|
var OP_NAME = {
|
|
3166
3236
|
APPEND: "appendBuffer",
|
|
3167
3237
|
REMOVE: "removeBuffer",
|
|
@@ -3182,6 +3252,12 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3182
3252
|
_defineProperty$1(this, "_logger", null);
|
|
3183
3253
|
_defineProperty$1(this, "_config", null);
|
|
3184
3254
|
_defineProperty$1(this, "_url", null);
|
|
3255
|
+
_defineProperty$1(this, "_onStartStreaming", function() {
|
|
3256
|
+
_this2._logger.debug("startstreaming");
|
|
3257
|
+
});
|
|
3258
|
+
_defineProperty$1(this, "_onEndStreaming", function() {
|
|
3259
|
+
_this2._logger.debug("endstreaming");
|
|
3260
|
+
});
|
|
3185
3261
|
_defineProperty$1(this, "_onSBUpdateEnd", function(type) {
|
|
3186
3262
|
var queue = _this2._queue[type];
|
|
3187
3263
|
if (queue) {
|
|
@@ -3190,8 +3266,9 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3190
3266
|
queue.shift();
|
|
3191
3267
|
}
|
|
3192
3268
|
if (op) {
|
|
3193
|
-
var
|
|
3194
|
-
|
|
3269
|
+
var _this2$_sourceBuffer$;
|
|
3270
|
+
var costtime = nowTime() - _this2._opst;
|
|
3271
|
+
_this2._logger.debug("UpdateEnd(".concat(type, "/").concat(op.opName, ")"), SafeJSON.stringify(getTimeRanges((_this2$_sourceBuffer$ = _this2._sourceBuffer[type]) === null || _this2$_sourceBuffer$ === void 0 ? void 0 : _this2$_sourceBuffer$.buffered)), costtime, op.context);
|
|
3195
3272
|
op.promise.resolve({
|
|
3196
3273
|
name: op.opName,
|
|
3197
3274
|
context: op.context,
|
|
@@ -3225,6 +3302,19 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3225
3302
|
var _this$mediaSource;
|
|
3226
3303
|
return ((_this$mediaSource = this.mediaSource) === null || _this$mediaSource === void 0 ? void 0 : _this$mediaSource.readyState) === "open";
|
|
3227
3304
|
}
|
|
3305
|
+
}, {
|
|
3306
|
+
key: "hasOpTasks",
|
|
3307
|
+
get: function get() {
|
|
3308
|
+
var _this3 = this;
|
|
3309
|
+
var flag = false;
|
|
3310
|
+
Object.keys(this._queue).forEach(function(k) {
|
|
3311
|
+
var queue = _this3._queue[k];
|
|
3312
|
+
if (Array.isArray(queue)) {
|
|
3313
|
+
flag || (flag = queue.length > 0);
|
|
3314
|
+
}
|
|
3315
|
+
});
|
|
3316
|
+
return flag;
|
|
3317
|
+
}
|
|
3228
3318
|
}, {
|
|
3229
3319
|
key: "url",
|
|
3230
3320
|
get: function get() {
|
|
@@ -3241,6 +3331,11 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3241
3331
|
get: function get() {
|
|
3242
3332
|
return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
|
|
3243
3333
|
}
|
|
3334
|
+
}, {
|
|
3335
|
+
key: "streaming",
|
|
3336
|
+
get: function get() {
|
|
3337
|
+
return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
|
|
3338
|
+
}
|
|
3244
3339
|
}, {
|
|
3245
3340
|
key: "isFull",
|
|
3246
3341
|
value: function isFull(type) {
|
|
@@ -3249,13 +3344,13 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3249
3344
|
}, {
|
|
3250
3345
|
key: "updateDuration",
|
|
3251
3346
|
value: function updateDuration(duration) {
|
|
3252
|
-
var
|
|
3347
|
+
var _this4 = this;
|
|
3253
3348
|
var isReduceDuration = this.mediaSource && this.mediaSource.duration > duration;
|
|
3254
3349
|
if (this.mediaSource && this.mediaSource.duration > duration) {
|
|
3255
3350
|
var bufferEnd = 0;
|
|
3256
3351
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3257
3352
|
try {
|
|
3258
|
-
bufferEnd = Math.max(
|
|
3353
|
+
bufferEnd = Math.max(_this4.bufferEnd(k) || 0, bufferEnd);
|
|
3259
3354
|
} catch (error) {
|
|
3260
3355
|
}
|
|
3261
3356
|
});
|
|
@@ -3264,13 +3359,13 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3264
3359
|
}
|
|
3265
3360
|
}
|
|
3266
3361
|
return this._enqueueBlockingOp(function() {
|
|
3267
|
-
if (
|
|
3268
|
-
|
|
3362
|
+
if (_this4.isEnded) {
|
|
3363
|
+
_this4._logger.debug("setDuration but ended");
|
|
3269
3364
|
return;
|
|
3270
3365
|
}
|
|
3271
|
-
if (
|
|
3272
|
-
|
|
3273
|
-
|
|
3366
|
+
if (_this4.mediaSource) {
|
|
3367
|
+
_this4.mediaSource.duration = duration;
|
|
3368
|
+
_this4._logger.debug("setDuration", duration);
|
|
3274
3369
|
}
|
|
3275
3370
|
}, OP_NAME.UPDATE_DURATION, {
|
|
3276
3371
|
isReduceDuration
|
|
@@ -3279,15 +3374,15 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3279
3374
|
}, {
|
|
3280
3375
|
key: "open",
|
|
3281
3376
|
value: function open() {
|
|
3282
|
-
var
|
|
3377
|
+
var _this5 = this;
|
|
3283
3378
|
if (this._openPromise.used && !this.isOpened && this.mediaSource) {
|
|
3284
3379
|
var ms = this.mediaSource;
|
|
3285
3380
|
var onOpen = function onOpen2() {
|
|
3286
|
-
var
|
|
3287
|
-
|
|
3381
|
+
var costTime = nowTime() - _this5._st;
|
|
3382
|
+
_this5._logger.debug("sourceopen", costTime);
|
|
3288
3383
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3289
|
-
|
|
3290
|
-
costtime
|
|
3384
|
+
_this5._openPromise.resolve({
|
|
3385
|
+
costtime: costTime
|
|
3291
3386
|
});
|
|
3292
3387
|
};
|
|
3293
3388
|
ms.addEventListener("sourceopen", onOpen);
|
|
@@ -3299,8 +3394,8 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3299
3394
|
key: "bindMedia",
|
|
3300
3395
|
value: function() {
|
|
3301
3396
|
var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
|
|
3302
|
-
var
|
|
3303
|
-
var ms, onOpen;
|
|
3397
|
+
var _this6 = this;
|
|
3398
|
+
var MediaSource2, ms, useMMS, onOpen;
|
|
3304
3399
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3305
3400
|
while (1)
|
|
3306
3401
|
switch (_context.prev = _context.next) {
|
|
@@ -3312,29 +3407,36 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3312
3407
|
_context.next = 3;
|
|
3313
3408
|
return this.unbindMedia();
|
|
3314
3409
|
case 3:
|
|
3315
|
-
|
|
3316
|
-
|
|
3410
|
+
MediaSource2 = getMediaSource(this._config.preferMMS);
|
|
3411
|
+
if (!(!media || !MediaSource2)) {
|
|
3412
|
+
_context.next = 6;
|
|
3317
3413
|
break;
|
|
3318
3414
|
}
|
|
3319
3415
|
throw new Error("Param media or MediaSource does not exist");
|
|
3320
|
-
case
|
|
3416
|
+
case 6:
|
|
3321
3417
|
this.media = media;
|
|
3322
|
-
ms = this.mediaSource = new
|
|
3323
|
-
|
|
3418
|
+
ms = this.mediaSource = new MediaSource2();
|
|
3419
|
+
useMMS = isMMS(ms);
|
|
3420
|
+
this._st = nowTime();
|
|
3324
3421
|
onOpen = function onOpen2() {
|
|
3325
|
-
var
|
|
3326
|
-
|
|
3422
|
+
var costTime = nowTime() - _this6._st;
|
|
3423
|
+
_this6._logger.debug("sourceopen");
|
|
3327
3424
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3328
3425
|
URL.revokeObjectURL(media.src);
|
|
3329
|
-
|
|
3330
|
-
costtime
|
|
3426
|
+
_this6._openPromise.resolve({
|
|
3427
|
+
costtime: costTime
|
|
3331
3428
|
});
|
|
3332
3429
|
};
|
|
3333
3430
|
ms.addEventListener("sourceopen", onOpen);
|
|
3431
|
+
if (useMMS) {
|
|
3432
|
+
ms.addEventListener("startstreaming", this._onStartStreaming);
|
|
3433
|
+
ms.addEventListener("endstreaming", this._onEndStreaming);
|
|
3434
|
+
}
|
|
3334
3435
|
this._url = URL.createObjectURL(ms);
|
|
3335
3436
|
media.src = this._url;
|
|
3437
|
+
media.disableRemotePlayback = useMMS;
|
|
3336
3438
|
return _context.abrupt("return", this._openPromise);
|
|
3337
|
-
case
|
|
3439
|
+
case 17:
|
|
3338
3440
|
case "end":
|
|
3339
3441
|
return _context.stop();
|
|
3340
3442
|
}
|
|
@@ -3349,7 +3451,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3349
3451
|
key: "unbindMedia",
|
|
3350
3452
|
value: function() {
|
|
3351
3453
|
var _unbindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
|
|
3352
|
-
var
|
|
3454
|
+
var _this7 = this;
|
|
3353
3455
|
var ms, hasMetadata, mseOpen;
|
|
3354
3456
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3355
3457
|
while (1)
|
|
@@ -3360,7 +3462,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3360
3462
|
ms = this.mediaSource;
|
|
3361
3463
|
if (ms) {
|
|
3362
3464
|
Object.keys(this._queue).forEach(function(t) {
|
|
3363
|
-
var queue =
|
|
3465
|
+
var queue = _this7._queue[t];
|
|
3364
3466
|
if (queue) {
|
|
3365
3467
|
queue.forEach(function(x) {
|
|
3366
3468
|
var _x$promise, _x$promise$resolve;
|
|
@@ -3378,12 +3480,17 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3378
3480
|
}
|
|
3379
3481
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3380
3482
|
try {
|
|
3381
|
-
ms.removeSourceBuffer(
|
|
3483
|
+
ms.removeSourceBuffer(_this7._sourceBuffer[k]);
|
|
3382
3484
|
} catch (error) {
|
|
3383
3485
|
}
|
|
3384
3486
|
});
|
|
3487
|
+
if (isMMS(ms)) {
|
|
3488
|
+
ms.removeEventListener("startstreaming", this._onStartStreaming);
|
|
3489
|
+
ms.removeEventListener("endstreaming", this._onEndStreaming);
|
|
3490
|
+
}
|
|
3385
3491
|
}
|
|
3386
3492
|
if (this.media) {
|
|
3493
|
+
this.media.disableRemotePlayback = false;
|
|
3387
3494
|
this.media.removeAttribute("src");
|
|
3388
3495
|
try {
|
|
3389
3496
|
this.media.load();
|
|
@@ -3424,7 +3531,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3424
3531
|
}, {
|
|
3425
3532
|
key: "changeType",
|
|
3426
3533
|
value: function changeType(type, mimeType) {
|
|
3427
|
-
var
|
|
3534
|
+
var _this8 = this;
|
|
3428
3535
|
var sb = this._sourceBuffer[type];
|
|
3429
3536
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3430
3537
|
return Promise.resolve();
|
|
@@ -3433,7 +3540,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3433
3540
|
return this._enqueueOp(type, function() {
|
|
3434
3541
|
sb.changeType(mimeType);
|
|
3435
3542
|
sb.mimeType = mimeType;
|
|
3436
|
-
|
|
3543
|
+
_this8._onSBUpdateEnd(type);
|
|
3437
3544
|
}, "changeType", {
|
|
3438
3545
|
mimeType
|
|
3439
3546
|
});
|
|
@@ -3447,60 +3554,60 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3447
3554
|
}, {
|
|
3448
3555
|
key: "append",
|
|
3449
3556
|
value: function append(type, buffer, context) {
|
|
3450
|
-
var
|
|
3557
|
+
var _this9 = this;
|
|
3451
3558
|
if (!buffer || !buffer.byteLength) {
|
|
3452
3559
|
return Promise.resolve();
|
|
3453
3560
|
}
|
|
3454
3561
|
if (!this._sourceBuffer[type])
|
|
3455
3562
|
return Promise.resolve();
|
|
3456
3563
|
return this._enqueueOp(type, function() {
|
|
3457
|
-
var
|
|
3458
|
-
if (!
|
|
3564
|
+
var _this9$_sourceBuffer$;
|
|
3565
|
+
if (!_this9.mediaSource || _this9.media.error)
|
|
3459
3566
|
return;
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
(
|
|
3567
|
+
_this9._logger.debug("MSE APPEND START", context);
|
|
3568
|
+
_this9._opst = nowTime();
|
|
3569
|
+
(_this9$_sourceBuffer$ = _this9._sourceBuffer[type]) === null || _this9$_sourceBuffer$ === void 0 ? void 0 : _this9$_sourceBuffer$.appendBuffer(buffer);
|
|
3463
3570
|
}, OP_NAME.APPEND, context);
|
|
3464
3571
|
}
|
|
3465
3572
|
}, {
|
|
3466
3573
|
key: "remove",
|
|
3467
3574
|
value: function remove(type, startTime, endTime, context) {
|
|
3468
|
-
var
|
|
3575
|
+
var _this10 = this;
|
|
3469
3576
|
var isInsertHead = false;
|
|
3470
3577
|
if (this._mseFullFlag[type]) {
|
|
3471
3578
|
isInsertHead = true;
|
|
3472
3579
|
}
|
|
3473
3580
|
return this._enqueueOp(type, function() {
|
|
3474
|
-
if (!
|
|
3581
|
+
if (!_this10.mediaSource || _this10.media.error)
|
|
3475
3582
|
return;
|
|
3476
|
-
var sb =
|
|
3583
|
+
var sb = _this10._sourceBuffer[type];
|
|
3477
3584
|
if (startTime >= endTime || !sb) {
|
|
3478
|
-
|
|
3585
|
+
_this10._onSBUpdateEnd(type);
|
|
3479
3586
|
return;
|
|
3480
3587
|
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3588
|
+
_this10._opst = nowTime();
|
|
3589
|
+
_this10._logger.debug("MSE REMOVE START", type, startTime, endTime, context);
|
|
3483
3590
|
sb.remove(startTime, endTime);
|
|
3484
3591
|
}, OP_NAME.REMOVE, context, isInsertHead);
|
|
3485
3592
|
}
|
|
3486
3593
|
}, {
|
|
3487
3594
|
key: "clearBuffer",
|
|
3488
3595
|
value: function clearBuffer(startTime, endTime) {
|
|
3489
|
-
var
|
|
3596
|
+
var _this11 = this;
|
|
3490
3597
|
var p;
|
|
3491
3598
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3492
|
-
p =
|
|
3599
|
+
p = _this11.remove(k, startTime, endTime);
|
|
3493
3600
|
});
|
|
3494
3601
|
return p || Promise.resolve();
|
|
3495
3602
|
}
|
|
3496
3603
|
}, {
|
|
3497
3604
|
key: "clearAllBuffer",
|
|
3498
3605
|
value: function clearAllBuffer() {
|
|
3499
|
-
var
|
|
3606
|
+
var _this12 = this;
|
|
3500
3607
|
var p;
|
|
3501
3608
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3502
|
-
var sb =
|
|
3503
|
-
p =
|
|
3609
|
+
var sb = _this12._sourceBuffer[k];
|
|
3610
|
+
p = _this12.remove(k, 0, Buffer$1.end(Buffer$1.get(sb)));
|
|
3504
3611
|
});
|
|
3505
3612
|
return p;
|
|
3506
3613
|
}
|
|
@@ -3516,26 +3623,26 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3516
3623
|
}
|
|
3517
3624
|
if (!queue || !queue[type] || queue.length < 5)
|
|
3518
3625
|
return;
|
|
3519
|
-
var
|
|
3626
|
+
var initQueue = [];
|
|
3520
3627
|
queue.forEach(function(op) {
|
|
3521
3628
|
if (op.context && op.context.isinit) {
|
|
3522
|
-
|
|
3629
|
+
initQueue.push(op);
|
|
3523
3630
|
}
|
|
3524
3631
|
});
|
|
3525
3632
|
this._queue[type] = queue.slice(0, 2);
|
|
3526
|
-
|
|
3633
|
+
initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
|
|
3527
3634
|
}
|
|
3528
3635
|
}, {
|
|
3529
3636
|
key: "endOfStream",
|
|
3530
3637
|
value: function endOfStream(reason) {
|
|
3531
|
-
var
|
|
3638
|
+
var _this13 = this;
|
|
3532
3639
|
if (!this.mediaSource || this.mediaSource.readyState !== "open")
|
|
3533
3640
|
return Promise.resolve();
|
|
3534
3641
|
return this._enqueueBlockingOp(function() {
|
|
3535
|
-
var ms =
|
|
3642
|
+
var ms = _this13.mediaSource;
|
|
3536
3643
|
if (!ms || ms.readyState !== "open")
|
|
3537
3644
|
return;
|
|
3538
|
-
|
|
3645
|
+
_this13._logger.debug("MSE endOfStream START");
|
|
3539
3646
|
if (reason) {
|
|
3540
3647
|
ms.endOfStream(reason);
|
|
3541
3648
|
} else {
|
|
@@ -3574,7 +3681,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3574
3681
|
}, {
|
|
3575
3682
|
key: "_enqueueOp",
|
|
3576
3683
|
value: function _enqueueOp(type, exec, opName, context, isInsertHead) {
|
|
3577
|
-
var
|
|
3684
|
+
var _this14 = this;
|
|
3578
3685
|
if (!this.mediaSource)
|
|
3579
3686
|
return Promise.resolve();
|
|
3580
3687
|
var queue = this._queue[type] = this._queue[type] || [];
|
|
@@ -3598,7 +3705,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3598
3705
|
} else {
|
|
3599
3706
|
this._openPromise.then(function() {
|
|
3600
3707
|
if (queue.length === 1) {
|
|
3601
|
-
|
|
3708
|
+
_this14._startQueue(type);
|
|
3602
3709
|
}
|
|
3603
3710
|
});
|
|
3604
3711
|
}
|
|
@@ -3608,7 +3715,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3608
3715
|
key: "_enqueueBlockingOp",
|
|
3609
3716
|
value: function() {
|
|
3610
3717
|
var _enqueueBlockingOp2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(exec, opName, context) {
|
|
3611
|
-
var
|
|
3718
|
+
var _this15 = this;
|
|
3612
3719
|
var types, waiters;
|
|
3613
3720
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3614
3721
|
while (1)
|
|
@@ -3629,7 +3736,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3629
3736
|
case 5:
|
|
3630
3737
|
waiters = [];
|
|
3631
3738
|
types.forEach(function(t) {
|
|
3632
|
-
var queue =
|
|
3739
|
+
var queue = _this15._queue[t];
|
|
3633
3740
|
var prom = createPublicPromise();
|
|
3634
3741
|
waiters.push(prom);
|
|
3635
3742
|
queue.push({
|
|
@@ -3641,7 +3748,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3641
3748
|
context
|
|
3642
3749
|
});
|
|
3643
3750
|
if (queue.length === 1) {
|
|
3644
|
-
|
|
3751
|
+
_this15._startQueue(t);
|
|
3645
3752
|
}
|
|
3646
3753
|
});
|
|
3647
3754
|
return _context3.abrupt("return", Promise.all(waiters).then(function() {
|
|
@@ -3649,11 +3756,11 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3649
3756
|
return exec();
|
|
3650
3757
|
} finally {
|
|
3651
3758
|
types.forEach(function(t) {
|
|
3652
|
-
var queue =
|
|
3653
|
-
var sb =
|
|
3759
|
+
var queue = _this15._queue[t];
|
|
3760
|
+
var sb = _this15._sourceBuffer[t];
|
|
3654
3761
|
queue === null || queue === void 0 ? void 0 : queue.shift();
|
|
3655
3762
|
if (!sb || !sb.updating) {
|
|
3656
|
-
|
|
3763
|
+
_this15._startQueue(t);
|
|
3657
3764
|
}
|
|
3658
3765
|
});
|
|
3659
3766
|
}
|
|
@@ -3696,47 +3803,54 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3696
3803
|
}, {
|
|
3697
3804
|
key: "setTimeoffset",
|
|
3698
3805
|
value: function setTimeoffset(type, timestampOffset, context) {
|
|
3699
|
-
var
|
|
3806
|
+
var _this16 = this;
|
|
3700
3807
|
return this._enqueueOp(type, function() {
|
|
3701
3808
|
if (timestampOffset < 0) {
|
|
3702
3809
|
timestampOffset += 1e-3;
|
|
3703
3810
|
}
|
|
3704
|
-
|
|
3705
|
-
|
|
3811
|
+
_this16._sourceBuffer[type].timestampOffset = timestampOffset;
|
|
3812
|
+
_this16._onSBUpdateEnd(type);
|
|
3706
3813
|
}, "setTimeoffset", context);
|
|
3707
3814
|
}
|
|
3708
3815
|
}, {
|
|
3709
3816
|
key: "abort",
|
|
3710
3817
|
value: function abort(type, context) {
|
|
3711
|
-
var
|
|
3818
|
+
var _this17 = this;
|
|
3712
3819
|
if (!this.isOpened) {
|
|
3713
3820
|
return Promise.resolve();
|
|
3714
3821
|
}
|
|
3715
3822
|
return this._enqueueOp(type, function() {
|
|
3716
|
-
|
|
3717
|
-
|
|
3823
|
+
_this17._sourceBuffer[type].abort();
|
|
3824
|
+
_this17._onSBUpdateEnd(type);
|
|
3718
3825
|
}, "abort", context);
|
|
3719
3826
|
}
|
|
3720
3827
|
}], [{
|
|
3721
|
-
key: "getDefaultConfig",
|
|
3722
|
-
value: function getDefaultConfig() {
|
|
3723
|
-
return {
|
|
3724
|
-
openLog: false
|
|
3725
|
-
};
|
|
3726
|
-
}
|
|
3727
|
-
}, {
|
|
3728
3828
|
key: "isSupported",
|
|
3729
3829
|
value: function isSupported() {
|
|
3730
3830
|
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3731
|
-
|
|
3831
|
+
var MediaSource2 = getMediaSource();
|
|
3832
|
+
if (!MediaSource2)
|
|
3732
3833
|
return false;
|
|
3733
3834
|
try {
|
|
3734
|
-
return
|
|
3835
|
+
return MediaSource2.isTypeSupported(mime);
|
|
3735
3836
|
} catch (error) {
|
|
3736
3837
|
this._logger.error(mime, error);
|
|
3737
3838
|
return false;
|
|
3738
3839
|
}
|
|
3739
3840
|
}
|
|
3841
|
+
}, {
|
|
3842
|
+
key: "isMMSOnly",
|
|
3843
|
+
value: function isMMSOnly() {
|
|
3844
|
+
return typeof ManagedMediaSource !== "undefined" && typeof MediaSource === "undefined";
|
|
3845
|
+
}
|
|
3846
|
+
}, {
|
|
3847
|
+
key: "getDefaultConfig",
|
|
3848
|
+
value: function getDefaultConfig() {
|
|
3849
|
+
return {
|
|
3850
|
+
openLog: false,
|
|
3851
|
+
preferMMS: false
|
|
3852
|
+
};
|
|
3853
|
+
}
|
|
3740
3854
|
}]);
|
|
3741
3855
|
return MSE2;
|
|
3742
3856
|
}();
|
|
@@ -3864,10 +3978,12 @@ var EVENT = {
|
|
|
3864
3978
|
LOAD_COMPLETE: "core.loadcomplete",
|
|
3865
3979
|
LOAD_RETRY: "core.loadretry",
|
|
3866
3980
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3981
|
+
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3867
3982
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3868
3983
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3869
3984
|
BUFFEREOS: "core.buffereos",
|
|
3870
3985
|
KEYFRAME: "core.keyframe",
|
|
3986
|
+
CHASEFRAME: "core.chaseframe",
|
|
3871
3987
|
METADATA_PARSED: "core.metadataparsed",
|
|
3872
3988
|
SEI: "core.sei",
|
|
3873
3989
|
SEI_IN_TIME: "core.seiintime",
|
|
@@ -4658,7 +4774,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
4658
4774
|
}]);
|
|
4659
4775
|
return XhrLoader2;
|
|
4660
4776
|
}(EventEmitter);
|
|
4661
|
-
var _excluded = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4777
|
+
var _excluded$1 = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4662
4778
|
var Task = /* @__PURE__ */ function() {
|
|
4663
4779
|
function Task2(type, config) {
|
|
4664
4780
|
_classCallCheck$1(this, Task2);
|
|
@@ -4678,7 +4794,7 @@ var Task = /* @__PURE__ */ function() {
|
|
|
4678
4794
|
key: "exec",
|
|
4679
4795
|
value: function exec() {
|
|
4680
4796
|
var _this = this;
|
|
4681
|
-
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);
|
|
4797
|
+
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$1);
|
|
4682
4798
|
var request = /* @__PURE__ */ function() {
|
|
4683
4799
|
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
4684
4800
|
var response, error, isRetry;
|
|
@@ -5514,6 +5630,26 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5514
5630
|
this.warnings = [];
|
|
5515
5631
|
this.hvcC = null;
|
|
5516
5632
|
}
|
|
5633
|
+
}, {
|
|
5634
|
+
key: "firstDts",
|
|
5635
|
+
get: function get() {
|
|
5636
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5637
|
+
}
|
|
5638
|
+
}, {
|
|
5639
|
+
key: "firstPts",
|
|
5640
|
+
get: function get() {
|
|
5641
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5642
|
+
}
|
|
5643
|
+
}, {
|
|
5644
|
+
key: "samplesDuration",
|
|
5645
|
+
get: function get() {
|
|
5646
|
+
if (this.samples.length > 0) {
|
|
5647
|
+
var first = this.samples[0];
|
|
5648
|
+
var last = this.samples[this.samples.length - 1];
|
|
5649
|
+
return last.dts - first.dts + last.duration;
|
|
5650
|
+
}
|
|
5651
|
+
return 0;
|
|
5652
|
+
}
|
|
5517
5653
|
}, {
|
|
5518
5654
|
key: "exist",
|
|
5519
5655
|
value: function exist() {
|
|
@@ -5592,6 +5728,26 @@ var AudioTrack = /* @__PURE__ */ function() {
|
|
|
5592
5728
|
get: function get() {
|
|
5593
5729
|
return this.isAudioEncryption;
|
|
5594
5730
|
}
|
|
5731
|
+
}, {
|
|
5732
|
+
key: "firstDts",
|
|
5733
|
+
get: function get() {
|
|
5734
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5735
|
+
}
|
|
5736
|
+
}, {
|
|
5737
|
+
key: "firstPts",
|
|
5738
|
+
get: function get() {
|
|
5739
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5740
|
+
}
|
|
5741
|
+
}, {
|
|
5742
|
+
key: "samplesDuration",
|
|
5743
|
+
get: function get() {
|
|
5744
|
+
if (this.samples.length > 0) {
|
|
5745
|
+
var first = this.samples[0];
|
|
5746
|
+
var last = this.samples[this.samples.length - 1];
|
|
5747
|
+
return last.dts - first.dts + last.duration;
|
|
5748
|
+
}
|
|
5749
|
+
return 0;
|
|
5750
|
+
}
|
|
5595
5751
|
}]);
|
|
5596
5752
|
return AudioTrack2;
|
|
5597
5753
|
}();
|
|
@@ -5942,7 +6098,7 @@ function getAvcCodec(codecs) {
|
|
|
5942
6098
|
}
|
|
5943
6099
|
return codec;
|
|
5944
6100
|
}
|
|
5945
|
-
function
|
|
6101
|
+
function parse2(a) {
|
|
5946
6102
|
if (!Array.isArray(a)) {
|
|
5947
6103
|
var arr = [];
|
|
5948
6104
|
var value = "";
|
|
@@ -6745,7 +6901,11 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6745
6901
|
var refSampleDurationInt;
|
|
6746
6902
|
if (videoTrack.fpsNum && videoTrack.fpsDen) {
|
|
6747
6903
|
refSampleDurationInt = videoTrack.timescale * (videoTrack.fpsDen / videoTrack.fpsNum);
|
|
6748
|
-
}
|
|
6904
|
+
}
|
|
6905
|
+
if (refSampleDurationInt < 90 * 10) {
|
|
6906
|
+
refSampleDurationInt = 0;
|
|
6907
|
+
}
|
|
6908
|
+
if (!refSampleDurationInt) {
|
|
6749
6909
|
var first = videoTrack.samples[0];
|
|
6750
6910
|
var second = videoTrack.samples[1];
|
|
6751
6911
|
refSampleDurationInt = len === 1 ? 9e3 : Math.floor(second.dts - first.dts);
|
|
@@ -6860,10 +7020,10 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6860
7020
|
}
|
|
6861
7021
|
audioTrack.warnings.push({
|
|
6862
7022
|
type: WarningType.AUDIO_FILLED,
|
|
6863
|
-
pts: sample.pts,
|
|
7023
|
+
pts: sample.pts / 90,
|
|
6864
7024
|
originPts: sample.originPts,
|
|
6865
7025
|
count,
|
|
6866
|
-
nextPts,
|
|
7026
|
+
nextPts: nextPts / 90,
|
|
6867
7027
|
refSampleDuration
|
|
6868
7028
|
});
|
|
6869
7029
|
for (var j = 0; j < count; j++) {
|
|
@@ -6879,9 +7039,9 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6879
7039
|
this._lastAudioExceptionOverlapDot = sample.pts;
|
|
6880
7040
|
audioTrack.warnings.push({
|
|
6881
7041
|
type: WarningType.AUDIO_DROPPED,
|
|
6882
|
-
pts: sample.pts,
|
|
7042
|
+
pts: sample.pts / 90,
|
|
6883
7043
|
originPts: sample.originPts,
|
|
6884
|
-
nextPts,
|
|
7044
|
+
nextPts: nextPts / 90,
|
|
6885
7045
|
refSampleDuration
|
|
6886
7046
|
});
|
|
6887
7047
|
}
|
|
@@ -6895,9 +7055,9 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6895
7055
|
audioTrack.warnings.push({
|
|
6896
7056
|
type: WarningType.LARGE_AUDIO_GAP,
|
|
6897
7057
|
time: sample.pts / 1e3,
|
|
6898
|
-
pts: sample.pts,
|
|
7058
|
+
pts: sample.pts / 90,
|
|
6899
7059
|
originPts: sample.originPts,
|
|
6900
|
-
nextPts,
|
|
7060
|
+
nextPts: nextPts / 90,
|
|
6901
7061
|
sampleDuration: delta,
|
|
6902
7062
|
refSampleDuration
|
|
6903
7063
|
});
|
|
@@ -7141,6 +7301,23 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7141
7301
|
if (!track.pps.length)
|
|
7142
7302
|
track.pps = [unit];
|
|
7143
7303
|
break;
|
|
7304
|
+
case 9:
|
|
7305
|
+
case 35:
|
|
7306
|
+
break;
|
|
7307
|
+
case 38:
|
|
7308
|
+
if (isHevc) {
|
|
7309
|
+
var ffByteFound = false;
|
|
7310
|
+
for (var i = 2; i < unit.byteLength; i++) {
|
|
7311
|
+
if (unit[i] === 255) {
|
|
7312
|
+
ffByteFound = true;
|
|
7313
|
+
break;
|
|
7314
|
+
}
|
|
7315
|
+
}
|
|
7316
|
+
if (!ffByteFound) {
|
|
7317
|
+
return;
|
|
7318
|
+
}
|
|
7319
|
+
}
|
|
7320
|
+
break;
|
|
7144
7321
|
}
|
|
7145
7322
|
sample.units.push(unit);
|
|
7146
7323
|
});
|
|
@@ -7668,6 +7845,7 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
7668
7845
|
key: "avcC",
|
|
7669
7846
|
value: function avcC(box) {
|
|
7670
7847
|
return parseBox(box, false, function(ret, data) {
|
|
7848
|
+
ret.data = box.data;
|
|
7671
7849
|
ret.configurationVersion = data[0];
|
|
7672
7850
|
ret.AVCProfileIndication = data[1];
|
|
7673
7851
|
ret.profileCompatibility = data[2];
|
|
@@ -8399,7 +8577,7 @@ function parseAudioSampleEntry(ret, data) {
|
|
|
8399
8577
|
ret.sampleRate = readBig32(data, 24) / (1 << 16);
|
|
8400
8578
|
return 28;
|
|
8401
8579
|
}
|
|
8402
|
-
function parseBox(box, isFullBox,
|
|
8580
|
+
function parseBox(box, isFullBox, parse3) {
|
|
8403
8581
|
if (!box)
|
|
8404
8582
|
return;
|
|
8405
8583
|
if (box.size !== box.data.length)
|
|
@@ -8415,7 +8593,7 @@ function parseBox(box, isFullBox, parse2) {
|
|
|
8415
8593
|
ret.flags = readBig24(box.data, box.headerSize + 1);
|
|
8416
8594
|
ret.headerSize += 4;
|
|
8417
8595
|
}
|
|
8418
|
-
|
|
8596
|
+
parse3(ret, box.data.subarray(ret.headerSize), ret.start + ret.headerSize);
|
|
8419
8597
|
return ret;
|
|
8420
8598
|
}
|
|
8421
8599
|
var padStart = function padStart2(str, length, pad) {
|
|
@@ -8641,7 +8819,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8641
8819
|
0,
|
|
8642
8820
|
0,
|
|
8643
8821
|
0
|
|
8644
|
-
].concat([16, 119, 239, 236, 192, 178, 77, 2, 172, 227, 60, 30, 82, 226, 251, 75], [0, 0, 0, 1],
|
|
8822
|
+
].concat([16, 119, 239, 236, 192, 178, 77, 2, 172, 227, 60, 30, 82, 226, 251, 75], [0, 0, 0, 1], parse2(data.kid), [0, 0, 0, 0]));
|
|
8645
8823
|
return MP42.box(MP42.types.pssh, content);
|
|
8646
8824
|
}
|
|
8647
8825
|
}, {
|
|
@@ -9129,7 +9307,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9129
9307
|
0,
|
|
9130
9308
|
data.default_IsEncrypted & 255,
|
|
9131
9309
|
data.default_IV_size & 255
|
|
9132
|
-
].concat(
|
|
9310
|
+
].concat(parse2(data.default_KID)));
|
|
9133
9311
|
return MP42.box(MP42.types.tenc, content);
|
|
9134
9312
|
}
|
|
9135
9313
|
}, {
|
|
@@ -10666,6 +10844,20 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
10666
10844
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.HLS, error);
|
|
10667
10845
|
}
|
|
10668
10846
|
var videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
10847
|
+
var vParsed = {
|
|
10848
|
+
codec: videoTrack.codec,
|
|
10849
|
+
timescale: videoTrack.timescale,
|
|
10850
|
+
firstDts: videoTrack.firstDts / videoTrack.timescale,
|
|
10851
|
+
firstPts: videoTrack.firstPts / videoTrack.timescale,
|
|
10852
|
+
duration: videoTrack.samplesDuration / videoTrack.timescale
|
|
10853
|
+
};
|
|
10854
|
+
var aParsed = {
|
|
10855
|
+
codec: audioTrack.codec,
|
|
10856
|
+
timescale: audioTrack.timescale,
|
|
10857
|
+
firstDts: audioTrack.firstDts / videoTrack.timescale,
|
|
10858
|
+
firstPts: audioTrack.firstPts / videoTrack.timescale,
|
|
10859
|
+
duration: audioTrack.samplesDuration / videoTrack.timescale
|
|
10860
|
+
};
|
|
10669
10861
|
var newId = "".concat(videoTrack.codec, "/").concat(videoTrack.width, "/").concat(videoTrack.height, "/").concat(audioTrack.codec, "/").concat(audioTrack.config);
|
|
10670
10862
|
if (newId !== this._initSegmentId) {
|
|
10671
10863
|
this._initSegmentId = newId;
|
|
@@ -10677,17 +10869,19 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
10677
10869
|
audioTrack
|
|
10678
10870
|
});
|
|
10679
10871
|
if (this._remuxer) {
|
|
10872
|
+
if (needInit && this.hls.isLive && !this.hls.config.mseLowLatency) {
|
|
10873
|
+
videoTrack.duration = this.hls.totalDuration * videoTrack.timescale;
|
|
10874
|
+
audioTrack.duration = this.hls.totalDuration * audioTrack.timescale;
|
|
10875
|
+
}
|
|
10680
10876
|
try {
|
|
10681
10877
|
var _this$_remuxer$remux = this._remuxer.remux(needInit), videoInitSegment = _this$_remuxer$remux.videoInitSegment, videoSegment = _this$_remuxer$remux.videoSegment, audioInitSegment = _this$_remuxer$remux.audioInitSegment, audioSegment = _this$_remuxer$remux.audioSegment;
|
|
10682
10878
|
var v = concatUint8Array$1(videoInitSegment, videoSegment);
|
|
10683
10879
|
var a = concatUint8Array$1(audioInitSegment, audioSegment);
|
|
10684
|
-
return [v ? {
|
|
10685
|
-
codec: videoTrack.codec,
|
|
10880
|
+
return [v ? _objectSpread2$2(_objectSpread2$2({}, vParsed), {}, {
|
|
10686
10881
|
data: v
|
|
10687
|
-
} : void 0, a ? {
|
|
10688
|
-
codec: audioTrack.codec,
|
|
10882
|
+
}) : void 0, a ? _objectSpread2$2(_objectSpread2$2({}, aParsed), {}, {
|
|
10689
10883
|
data: a
|
|
10690
|
-
} : void 0];
|
|
10884
|
+
}) : void 0];
|
|
10691
10885
|
} catch (error) {
|
|
10692
10886
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, error);
|
|
10693
10887
|
}
|
|
@@ -10699,37 +10893,34 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
10699
10893
|
key: "_fireEvents",
|
|
10700
10894
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack, discontinuity) {
|
|
10701
10895
|
var _this = this;
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
timescale: audioTrack.timescale,
|
|
10727
|
-
baseDts: audioTrack.baseDts
|
|
10728
|
-
}
|
|
10896
|
+
var tracks = [videoTrack, audioTrack];
|
|
10897
|
+
var logCC = "discontinuity: ".concat(discontinuity);
|
|
10898
|
+
tracks.forEach(function(track) {
|
|
10899
|
+
var _track$samples;
|
|
10900
|
+
if ((_track$samples = track.samples) !== null && _track$samples !== void 0 && _track$samples.length) {
|
|
10901
|
+
logCC += "; ".concat(track.samples.length, " ").concat(track.type === TrackType.VIDEO ? "video" : "audio", " samples, firstDts/firstPts/duration: ").concat((track.firstDts / track.timescale).toFixed(3), "/").concat((track.firstPts / track.timescale).toFixed(3), "/").concat((track.samplesDuration / track.timescale).toFixed(3));
|
|
10902
|
+
}
|
|
10903
|
+
if (discontinuity && track.exist()) {
|
|
10904
|
+
_this.hls.emit(Event$1.METADATA_PARSED, {
|
|
10905
|
+
type: track.type,
|
|
10906
|
+
track,
|
|
10907
|
+
meta: _objectSpread2$2({
|
|
10908
|
+
codec: track.codec,
|
|
10909
|
+
timescale: track.timescale,
|
|
10910
|
+
baseDts: track.baseDts
|
|
10911
|
+
}, track.type === TrackType.VIDEO ? {
|
|
10912
|
+
width: track.width,
|
|
10913
|
+
height: track.height,
|
|
10914
|
+
sarRatio: track.sarRatio
|
|
10915
|
+
} : {
|
|
10916
|
+
codec: track.codec,
|
|
10917
|
+
channelCount: track.channelCount,
|
|
10918
|
+
sampleRate: track.sampleRate
|
|
10919
|
+
})
|
|
10729
10920
|
});
|
|
10730
10921
|
}
|
|
10731
|
-
|
|
10732
|
-
|
|
10922
|
+
});
|
|
10923
|
+
logger$3.debug(logCC);
|
|
10733
10924
|
videoTrack.warnings.forEach(function(warn) {
|
|
10734
10925
|
var type;
|
|
10735
10926
|
switch (warn.type) {
|
|
@@ -10789,9 +10980,11 @@ var Transmuxer = /* @__PURE__ */ function() {
|
|
|
10789
10980
|
}]);
|
|
10790
10981
|
return Transmuxer2;
|
|
10791
10982
|
}();
|
|
10983
|
+
var _excluded = ["data"], _excluded2 = ["data"];
|
|
10792
10984
|
var logger$2 = new Logger$2("BufferService");
|
|
10793
10985
|
var BufferService = /* @__PURE__ */ function() {
|
|
10794
10986
|
function BufferService2(hls) {
|
|
10987
|
+
var _this = this;
|
|
10795
10988
|
_classCallCheck$3(this, BufferService2);
|
|
10796
10989
|
_defineProperty$3(this, "_decryptor", new Decryptor());
|
|
10797
10990
|
_defineProperty$3(this, "_transmuxer", null);
|
|
@@ -10804,9 +10997,13 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10804
10997
|
if (hls.config.softDecode) {
|
|
10805
10998
|
this._softVideo = hls.media;
|
|
10806
10999
|
} else {
|
|
10807
|
-
this._mse = new MSE(
|
|
11000
|
+
this._mse = new MSE(null, {
|
|
11001
|
+
preferMMS: hls.config.preferMMS
|
|
11002
|
+
});
|
|
10808
11003
|
if (hls.config.url) {
|
|
10809
|
-
this._mse.bindMedia(hls.media)
|
|
11004
|
+
this._mse.bindMedia(hls.media).then(function(e) {
|
|
11005
|
+
_this.hls.emit(EVENT.MEDIASOURCE_OPENED, e);
|
|
11006
|
+
});
|
|
10810
11007
|
}
|
|
10811
11008
|
}
|
|
10812
11009
|
if (hls.config.decryptor) {
|
|
@@ -10828,11 +11025,23 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10828
11025
|
return Object.keys(this._mse._sourceBuffer).length;
|
|
10829
11026
|
}
|
|
10830
11027
|
}, {
|
|
10831
|
-
key: "
|
|
11028
|
+
key: "msIsOpened",
|
|
10832
11029
|
get: function get() {
|
|
10833
11030
|
var _this$_mse2;
|
|
10834
11031
|
return (_this$_mse2 = this._mse) === null || _this$_mse2 === void 0 ? void 0 : _this$_mse2.isOpened;
|
|
10835
11032
|
}
|
|
11033
|
+
}, {
|
|
11034
|
+
key: "msHasOpTasks",
|
|
11035
|
+
get: function get() {
|
|
11036
|
+
var _this$_mse3;
|
|
11037
|
+
return (_this$_mse3 = this._mse) === null || _this$_mse3 === void 0 ? void 0 : _this$_mse3.hasOpTasks;
|
|
11038
|
+
}
|
|
11039
|
+
}, {
|
|
11040
|
+
key: "msStreaming",
|
|
11041
|
+
get: function get() {
|
|
11042
|
+
var _this$_mse4;
|
|
11043
|
+
return (_this$_mse4 = this._mse) === null || _this$_mse4 === void 0 ? void 0 : _this$_mse4.streaming;
|
|
11044
|
+
}
|
|
10836
11045
|
}, {
|
|
10837
11046
|
key: "updateDuration",
|
|
10838
11047
|
value: function() {
|
|
@@ -10937,7 +11146,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10937
11146
|
key: "appendBuffer",
|
|
10938
11147
|
value: function() {
|
|
10939
11148
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(segment, audioSegment, videoChunk, audioChunk, discontinuity, contiguous, startTime) {
|
|
10940
|
-
var p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p;
|
|
11149
|
+
var p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p, videoData, videoRest, audioData, audioRest;
|
|
10941
11150
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10942
11151
|
while (1)
|
|
10943
11152
|
switch (_context2.prev = _context2.next) {
|
|
@@ -10960,7 +11169,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10960
11169
|
return _context2.abrupt("return", Promise.all(p));
|
|
10961
11170
|
case 7:
|
|
10962
11171
|
needInit = this._needInitSegment || discontinuity;
|
|
10963
|
-
_this$_transmuxer$tra = this._transmuxer.transmux(videoChunk, audioChunk,
|
|
11172
|
+
_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];
|
|
10964
11173
|
if (audioChunk && audioSegment) {
|
|
10965
11174
|
audioSegment === null || audioSegment === void 0 ? void 0 : audioSegment.setTrackExist(false, true);
|
|
10966
11175
|
}
|
|
@@ -10996,10 +11205,14 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10996
11205
|
if (needInit && !isFirstAppend) {
|
|
10997
11206
|
this._handleCodecChange(video, audio);
|
|
10998
11207
|
}
|
|
10999
|
-
if (video)
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11208
|
+
if (video) {
|
|
11209
|
+
videoData = video.data, videoRest = _objectWithoutProperties$1(video, _excluded);
|
|
11210
|
+
_p.push(mse.append(MSE.VIDEO, videoData, videoRest));
|
|
11211
|
+
}
|
|
11212
|
+
if (audio) {
|
|
11213
|
+
audioData = audio.data, audioRest = _objectWithoutProperties$1(audio, _excluded2);
|
|
11214
|
+
_p.push(mse.append(MSE.AUDIO, audioData, audioRest));
|
|
11215
|
+
}
|
|
11003
11216
|
return _context2.abrupt("return", Promise.all(_p));
|
|
11004
11217
|
case 28:
|
|
11005
11218
|
case "end":
|
|
@@ -11016,7 +11229,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11016
11229
|
key: "removeBuffer",
|
|
11017
11230
|
value: function() {
|
|
11018
11231
|
var _removeBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
11019
|
-
var
|
|
11232
|
+
var _this2 = this;
|
|
11020
11233
|
var start, end, media, _args3 = arguments;
|
|
11021
11234
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
11022
11235
|
while (1)
|
|
@@ -11032,7 +11245,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11032
11245
|
return _context3.abrupt("return");
|
|
11033
11246
|
case 5:
|
|
11034
11247
|
return _context3.abrupt("return", this._mse.clearBuffer(start, end).then(function() {
|
|
11035
|
-
return
|
|
11248
|
+
return _this2.hls.emit(EVENT.REMOVE_BUFFER, {
|
|
11036
11249
|
start,
|
|
11037
11250
|
end,
|
|
11038
11251
|
removeEnd: end
|
|
@@ -11292,9 +11505,9 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11292
11505
|
}, {
|
|
11293
11506
|
key: "isFull",
|
|
11294
11507
|
value: function isFull() {
|
|
11295
|
-
var _this$
|
|
11508
|
+
var _this$_mse5;
|
|
11296
11509
|
var mediaType = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : MSE.VIDEO;
|
|
11297
|
-
return (_this$
|
|
11510
|
+
return (_this$_mse5 = this._mse) === null || _this$_mse5 === void 0 ? void 0 : _this$_mse5.isFull(mediaType);
|
|
11298
11511
|
}
|
|
11299
11512
|
}]);
|
|
11300
11513
|
return BufferService2;
|
|
@@ -11319,7 +11532,10 @@ function getConfig(cfg) {
|
|
|
11319
11532
|
allowedStreamTrackChange: true,
|
|
11320
11533
|
seiInTime: false,
|
|
11321
11534
|
manifestList: [],
|
|
11322
|
-
minSegmentsStartPlay: 3
|
|
11535
|
+
minSegmentsStartPlay: 3,
|
|
11536
|
+
preferMMS: false,
|
|
11537
|
+
preferMMSStreaming: false,
|
|
11538
|
+
mseLowLatency: true
|
|
11323
11539
|
}, cfg), {}, {
|
|
11324
11540
|
media
|
|
11325
11541
|
});
|
|
@@ -11336,6 +11552,12 @@ var MediaType = {
|
|
|
11336
11552
|
SubTitle: "SUBTITLE",
|
|
11337
11553
|
ClosedCaptions: "CLOSED-CAPTIONS"
|
|
11338
11554
|
};
|
|
11555
|
+
var KeySystems = {
|
|
11556
|
+
CLEAR_KEY: "org.w3.clearkey",
|
|
11557
|
+
FAIRPLAY: "com.apple.streamingkeydelivery",
|
|
11558
|
+
WIDEVINE: "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
|
|
11559
|
+
PLAYREADY: "com.microsoft.playready"
|
|
11560
|
+
};
|
|
11339
11561
|
var MediaStream = /* @__PURE__ */ _createClass$3(function MediaStream2() {
|
|
11340
11562
|
_classCallCheck$3(this, MediaStream2);
|
|
11341
11563
|
_defineProperty$3(this, "id", 0);
|
|
@@ -11419,11 +11641,12 @@ var MediaPlaylist = /* @__PURE__ */ _createClass$3(function MediaPlaylist2() {
|
|
|
11419
11641
|
_defineProperty$3(this, "segments", []);
|
|
11420
11642
|
});
|
|
11421
11643
|
var MediaSegment = /* @__PURE__ */ function() {
|
|
11422
|
-
function MediaSegment2() {
|
|
11644
|
+
function MediaSegment2(parentUrl) {
|
|
11423
11645
|
_classCallCheck$3(this, MediaSegment2);
|
|
11424
11646
|
_defineProperty$3(this, "sn", 0);
|
|
11425
11647
|
_defineProperty$3(this, "cc", 0);
|
|
11426
11648
|
_defineProperty$3(this, "url", "");
|
|
11649
|
+
_defineProperty$3(this, "parentUrl", "");
|
|
11427
11650
|
_defineProperty$3(this, "title", "");
|
|
11428
11651
|
_defineProperty$3(this, "start", 0);
|
|
11429
11652
|
_defineProperty$3(this, "duration", 0);
|
|
@@ -11437,6 +11660,7 @@ var MediaSegment = /* @__PURE__ */ function() {
|
|
|
11437
11660
|
_defineProperty$3(this, "hasVideo", false);
|
|
11438
11661
|
_defineProperty$3(this, "independent", false);
|
|
11439
11662
|
_defineProperty$3(this, "partIndex", 0);
|
|
11663
|
+
this.parentUrl = parentUrl;
|
|
11440
11664
|
}
|
|
11441
11665
|
_createClass$3(MediaSegment2, [{
|
|
11442
11666
|
key: "end",
|
|
@@ -11501,6 +11725,38 @@ var MediaSegmentKey = /* @__PURE__ */ function() {
|
|
|
11501
11725
|
}
|
|
11502
11726
|
}
|
|
11503
11727
|
}
|
|
11728
|
+
}, {
|
|
11729
|
+
key: "isSegmentEncrypted",
|
|
11730
|
+
value: function isSegmentEncrypted() {
|
|
11731
|
+
var method = this.method;
|
|
11732
|
+
return method === "AES-128";
|
|
11733
|
+
}
|
|
11734
|
+
}, {
|
|
11735
|
+
key: "isValidKeySystem",
|
|
11736
|
+
value: function isValidKeySystem() {
|
|
11737
|
+
var isKeyFormatValid = [KeySystems.CLEAR_KEY, KeySystems.FAIRPLAY, KeySystems.WIDEVINE, KeySystems.PLAYREADY].indexOf(this.keyFormat) > -1;
|
|
11738
|
+
if (!isKeyFormatValid) {
|
|
11739
|
+
return false;
|
|
11740
|
+
}
|
|
11741
|
+
var isMethodValid = ["SAMPLE-AES", "SAMPLE-AES-CENC", "SAMPLE-AES-CTR"].indexOf(this.method) > -1;
|
|
11742
|
+
if (!isMethodValid) {
|
|
11743
|
+
return false;
|
|
11744
|
+
}
|
|
11745
|
+
return true;
|
|
11746
|
+
}
|
|
11747
|
+
}, {
|
|
11748
|
+
key: "isSupported",
|
|
11749
|
+
value: function isSupported() {
|
|
11750
|
+
if (!this.method) {
|
|
11751
|
+
return false;
|
|
11752
|
+
}
|
|
11753
|
+
if (this.isSegmentEncrypted()) {
|
|
11754
|
+
return true;
|
|
11755
|
+
} else if (this.isValidKeySystem()) {
|
|
11756
|
+
return true;
|
|
11757
|
+
}
|
|
11758
|
+
return false;
|
|
11759
|
+
}
|
|
11504
11760
|
}]);
|
|
11505
11761
|
return MediaSegmentKey2;
|
|
11506
11762
|
}();
|
|
@@ -11651,7 +11907,7 @@ function parseMasterPlaylist(lines, parentUrl) {
|
|
|
11651
11907
|
function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
11652
11908
|
var media = new MediaPlaylist();
|
|
11653
11909
|
media.url = parentUrl;
|
|
11654
|
-
var curSegment = new MediaSegment();
|
|
11910
|
+
var curSegment = new MediaSegment(parentUrl);
|
|
11655
11911
|
var curInitSegment = null;
|
|
11656
11912
|
var curKey = null;
|
|
11657
11913
|
var totalDuration = 0;
|
|
@@ -11678,7 +11934,7 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11678
11934
|
if (curInitSegment)
|
|
11679
11935
|
curSegment.initSegment = curInitSegment;
|
|
11680
11936
|
media.segments.push(curSegment);
|
|
11681
|
-
curSegment = new MediaSegment();
|
|
11937
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11682
11938
|
curSN++;
|
|
11683
11939
|
continue;
|
|
11684
11940
|
}
|
|
@@ -11757,7 +12013,7 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11757
12013
|
if (curInitSegment)
|
|
11758
12014
|
curSegment.initSegment = curInitSegment;
|
|
11759
12015
|
media.segments.push(curSegment);
|
|
11760
|
-
curSegment = new MediaSegment();
|
|
12016
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11761
12017
|
partSegmentIndex++;
|
|
11762
12018
|
}
|
|
11763
12019
|
break;
|
|
@@ -11786,13 +12042,14 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11786
12042
|
curKey = null;
|
|
11787
12043
|
break;
|
|
11788
12044
|
}
|
|
11789
|
-
if (_attr3.METHOD !== "AES-128")
|
|
11790
|
-
throw new Error("encrypt ".concat(_attr3.METHOD, "/").concat(_attr3.KEYFORMAT, " is not supported"));
|
|
11791
12045
|
curKey = new MediaSegmentKey();
|
|
11792
12046
|
curKey.method = _attr3.METHOD;
|
|
11793
12047
|
curKey.url = /^blob:/.test(_attr3.URI) ? _attr3.URI : getAbsoluteUrl(_attr3.URI, parentUrl);
|
|
11794
12048
|
curKey.keyFormat = _attr3.KEYFORMAT || "identity";
|
|
11795
12049
|
curKey.keyFormatVersions = _attr3.KEYFORMATVERSIONS;
|
|
12050
|
+
if (!curKey.isSupported()) {
|
|
12051
|
+
throw new Error("encrypt ".concat(_attr3.METHOD, "/").concat(_attr3.KEYFORMAT, " is not supported"));
|
|
12052
|
+
}
|
|
11796
12053
|
if (_attr3.IV) {
|
|
11797
12054
|
var str = _attr3.IV.slice(2);
|
|
11798
12055
|
str = (str.length & 1 ? "0" : "") + str;
|
|
@@ -11815,7 +12072,7 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11815
12072
|
curSegment.key = curKey.clone(0);
|
|
11816
12073
|
}
|
|
11817
12074
|
curInitSegment = curSegment;
|
|
11818
|
-
curSegment = new MediaSegment();
|
|
12075
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11819
12076
|
}
|
|
11820
12077
|
break;
|
|
11821
12078
|
}
|
|
@@ -11827,6 +12084,9 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11827
12084
|
if (lastSegment) {
|
|
11828
12085
|
media.endSN = lastSegment.sn;
|
|
11829
12086
|
media.endPartIndex = lastSegment.partIndex;
|
|
12087
|
+
if (endOfList && !lastSegment.isLast) {
|
|
12088
|
+
lastSegment.isLast = true;
|
|
12089
|
+
}
|
|
11830
12090
|
}
|
|
11831
12091
|
media.totalDuration = totalDuration;
|
|
11832
12092
|
media.endCC = curCC;
|
|
@@ -11838,7 +12098,7 @@ var M3U8Parser = /* @__PURE__ */ function() {
|
|
|
11838
12098
|
}
|
|
11839
12099
|
_createClass$3(M3U8Parser2, null, [{
|
|
11840
12100
|
key: "parse",
|
|
11841
|
-
value: function
|
|
12101
|
+
value: function parse3() {
|
|
11842
12102
|
var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
11843
12103
|
var parentUrl = arguments.length > 1 ? arguments[1] : void 0;
|
|
11844
12104
|
var useLowLatency = arguments.length > 2 ? arguments[2] : void 0;
|
|
@@ -12178,12 +12438,20 @@ var Stream = /* @__PURE__ */ function() {
|
|
|
12178
12438
|
key: "liveEdge",
|
|
12179
12439
|
get: function get() {
|
|
12180
12440
|
return this.endTime;
|
|
12441
|
+
},
|
|
12442
|
+
set: function set(end) {
|
|
12443
|
+
this.endTime = end;
|
|
12181
12444
|
}
|
|
12182
12445
|
}, {
|
|
12183
12446
|
key: "endTime",
|
|
12184
12447
|
get: function get() {
|
|
12185
12448
|
var _this$lastSegment;
|
|
12186
12449
|
return ((_this$lastSegment = this.lastSegment) === null || _this$lastSegment === void 0 ? void 0 : _this$lastSegment.end) || 0;
|
|
12450
|
+
},
|
|
12451
|
+
set: function set(end) {
|
|
12452
|
+
var lastSeg = this.lastSegment;
|
|
12453
|
+
if (lastSeg)
|
|
12454
|
+
lastSeg.duration = end - lastSeg.start;
|
|
12187
12455
|
}
|
|
12188
12456
|
}, {
|
|
12189
12457
|
key: "currentSubtitleEndSn",
|
|
@@ -12350,9 +12618,10 @@ var Stream = /* @__PURE__ */ function() {
|
|
|
12350
12618
|
value: function _updateSegments(playlist, segObj) {
|
|
12351
12619
|
var segments = segObj.segments;
|
|
12352
12620
|
if (this.live) {
|
|
12621
|
+
var _endSeg$sn;
|
|
12353
12622
|
var lowLatency = playlist.lowLatency;
|
|
12354
12623
|
var endSeg = segments[segments.length - 1];
|
|
12355
|
-
var endSN = (endSeg === null || endSeg === void 0 ? void 0 : endSeg.sn)
|
|
12624
|
+
var endSN = (_endSeg$sn = endSeg === null || endSeg === void 0 ? void 0 : endSeg.sn) !== null && _endSeg$sn !== void 0 ? _endSeg$sn : -1;
|
|
12356
12625
|
var endPartIndex = (endSeg === null || endSeg === void 0 ? void 0 : endSeg.partIndex) || 0;
|
|
12357
12626
|
var hasNew = endSN < playlist.endSN && playlist.segments.length;
|
|
12358
12627
|
if (lowLatency) {
|
|
@@ -12440,6 +12709,11 @@ var Playlist = /* @__PURE__ */ function() {
|
|
|
12440
12709
|
get: function get() {
|
|
12441
12710
|
var _this$currentStream5;
|
|
12442
12711
|
return (_this$currentStream5 = this.currentStream) === null || _this$currentStream5 === void 0 ? void 0 : _this$currentStream5.liveEdge;
|
|
12712
|
+
},
|
|
12713
|
+
set: function set(end) {
|
|
12714
|
+
if (this.currentStream) {
|
|
12715
|
+
this.currentStream.liveEdge = end;
|
|
12716
|
+
}
|
|
12443
12717
|
}
|
|
12444
12718
|
}, {
|
|
12445
12719
|
key: "totalDuration",
|
|
@@ -12518,6 +12792,19 @@ var Playlist = /* @__PURE__ */ function() {
|
|
|
12518
12792
|
var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
12519
12793
|
this._segmentPointer = index - 1;
|
|
12520
12794
|
}
|
|
12795
|
+
}, {
|
|
12796
|
+
key: "setNextSegmentBySN",
|
|
12797
|
+
value: function setNextSegmentBySN() {
|
|
12798
|
+
var _this$currentSegments7;
|
|
12799
|
+
var sn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
12800
|
+
var preIndex = (_this$currentSegments7 = this.currentSegments) === null || _this$currentSegments7 === void 0 ? void 0 : _this$currentSegments7.findIndex(function(x) {
|
|
12801
|
+
return x.sn === sn;
|
|
12802
|
+
});
|
|
12803
|
+
if (preIndex !== -1) {
|
|
12804
|
+
this.setNextSegmentByIndex(preIndex + 1);
|
|
12805
|
+
}
|
|
12806
|
+
return preIndex;
|
|
12807
|
+
}
|
|
12521
12808
|
}, {
|
|
12522
12809
|
key: "findSegmentIndexByTime",
|
|
12523
12810
|
value: function findSegmentIndexByTime(time) {
|
|
@@ -12577,6 +12864,18 @@ var Playlist = /* @__PURE__ */ function() {
|
|
|
12577
12864
|
}
|
|
12578
12865
|
}
|
|
12579
12866
|
}
|
|
12867
|
+
}, {
|
|
12868
|
+
key: "updateSegmentsRanges",
|
|
12869
|
+
value: function updateSegmentsRanges(sn, start) {
|
|
12870
|
+
var _this$currentSegments8;
|
|
12871
|
+
var segs = (_this$currentSegments8 = this.currentSegments) === null || _this$currentSegments8 === void 0 ? void 0 : _this$currentSegments8.filter(function(x) {
|
|
12872
|
+
return x.sn >= sn;
|
|
12873
|
+
});
|
|
12874
|
+
segs.forEach(function(s) {
|
|
12875
|
+
s.start = start;
|
|
12876
|
+
start = s.end;
|
|
12877
|
+
});
|
|
12878
|
+
}
|
|
12580
12879
|
}, {
|
|
12581
12880
|
key: "switchSubtitle",
|
|
12582
12881
|
value: function switchSubtitle(lang) {
|
|
@@ -12619,6 +12918,20 @@ var Playlist = /* @__PURE__ */ function() {
|
|
|
12619
12918
|
if (next.hasAudio !== seg.hasAudio || next.hasVideo !== seg.hasVideo)
|
|
12620
12919
|
return next;
|
|
12621
12920
|
}
|
|
12921
|
+
}, {
|
|
12922
|
+
key: "feedbackLiveEdge",
|
|
12923
|
+
value: function feedbackLiveEdge(segment, bufferEnd) {
|
|
12924
|
+
var _this$lastSegment;
|
|
12925
|
+
var segs = this.currentSegments;
|
|
12926
|
+
if (!segs)
|
|
12927
|
+
return;
|
|
12928
|
+
var isLast = ((_this$lastSegment = this.lastSegment) === null || _this$lastSegment === void 0 ? void 0 : _this$lastSegment.sn) === segment.sn;
|
|
12929
|
+
if (isLast) {
|
|
12930
|
+
this.liveEdge = bufferEnd;
|
|
12931
|
+
return;
|
|
12932
|
+
}
|
|
12933
|
+
this.updateSegmentsRanges(segment.sn + 1, bufferEnd);
|
|
12934
|
+
}
|
|
12622
12935
|
}]);
|
|
12623
12936
|
return Playlist2;
|
|
12624
12937
|
}();
|
|
@@ -12763,7 +13076,7 @@ var SegmentLoader = /* @__PURE__ */ function() {
|
|
|
12763
13076
|
}
|
|
12764
13077
|
}
|
|
12765
13078
|
keyUrl = (_seg$key = seg.key) === null || _seg$key === void 0 ? void 0 : _seg$key.url;
|
|
12766
|
-
if (keyUrl) {
|
|
13079
|
+
if (keyUrl && seg.key.isSegmentEncrypted()) {
|
|
12767
13080
|
keyIv = seg.key.iv;
|
|
12768
13081
|
key = this._keyCache[keyUrl];
|
|
12769
13082
|
if (!key) {
|
|
@@ -12870,7 +13183,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12870
13183
|
_defineProperty$3(_assertThisInitialized$2(_this), "_switchUrlOpts", null);
|
|
12871
13184
|
_defineProperty$3(_assertThisInitialized$2(_this), "_isProcessQuotaExceeded", false);
|
|
12872
13185
|
_defineProperty$3(_assertThisInitialized$2(_this), "_loadSegment", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
12873
|
-
var nextSeg, bInfo, bufferThroughout;
|
|
13186
|
+
var nextSeg, _assertThisInitialize, config, bInfo, bufferThroughout;
|
|
12874
13187
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
12875
13188
|
while (1)
|
|
12876
13189
|
switch (_context.prev = _context.next) {
|
|
@@ -12882,14 +13195,15 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12882
13195
|
return _context.abrupt("return");
|
|
12883
13196
|
case 2:
|
|
12884
13197
|
nextSeg = _this._playlist.nextSegment;
|
|
13198
|
+
_assertThisInitialize = _assertThisInitialized$2(_this), config = _assertThisInitialize.config;
|
|
12885
13199
|
if (nextSeg) {
|
|
12886
|
-
_context.next =
|
|
13200
|
+
_context.next = 6;
|
|
12887
13201
|
break;
|
|
12888
13202
|
}
|
|
12889
13203
|
return _context.abrupt("return");
|
|
12890
|
-
case
|
|
13204
|
+
case 6:
|
|
12891
13205
|
if (_this.isLive) {
|
|
12892
|
-
_context.next =
|
|
13206
|
+
_context.next = 16;
|
|
12893
13207
|
break;
|
|
12894
13208
|
}
|
|
12895
13209
|
bInfo = _this.bufferInfo();
|
|
@@ -12897,26 +13211,38 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12897
13211
|
bInfo = _this.bufferInfo(bInfo.nextStart || 0.5);
|
|
12898
13212
|
}
|
|
12899
13213
|
bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < 0.1;
|
|
12900
|
-
if (!(bInfo.remaining >=
|
|
12901
|
-
_context.next =
|
|
13214
|
+
if (!(bInfo.remaining >= config.preloadTime || bufferThroughout)) {
|
|
13215
|
+
_context.next = 13;
|
|
12902
13216
|
break;
|
|
12903
13217
|
}
|
|
12904
|
-
|
|
12905
|
-
|
|
13218
|
+
_this._tryEos();
|
|
13219
|
+
return _context.abrupt("return");
|
|
13220
|
+
case 13:
|
|
13221
|
+
if (!(config.preferMMSStreaming && !_this._bufferService.msStreaming)) {
|
|
13222
|
+
_context.next = 15;
|
|
13223
|
+
break;
|
|
12906
13224
|
}
|
|
12907
13225
|
return _context.abrupt("return");
|
|
12908
|
-
case
|
|
13226
|
+
case 15:
|
|
12909
13227
|
if (!_this._urlSwitching && _this._prevSegSn !== nextSeg.sn - 1 && bInfo.end && Math.abs(nextSeg.start - bInfo.end) > 1) {
|
|
12910
13228
|
_this._playlist.setNextSegmentByIndex(_this._playlist.findSegmentIndexByTime(bInfo.end + 0.1));
|
|
12911
13229
|
}
|
|
12912
|
-
case
|
|
13230
|
+
case 16:
|
|
12913
13231
|
return _context.abrupt("return", _this._loadSegmentDirect());
|
|
12914
|
-
case
|
|
13232
|
+
case 17:
|
|
12915
13233
|
case "end":
|
|
12916
13234
|
return _context.stop();
|
|
12917
13235
|
}
|
|
12918
13236
|
}, _callee);
|
|
12919
13237
|
})));
|
|
13238
|
+
_defineProperty$3(_assertThisInitialized$2(_this), "_onLoadeddata", function() {
|
|
13239
|
+
if (_this.isLive && !_this.config.mseLowLatency) {
|
|
13240
|
+
if (_this.media.duration !== Infinity) {
|
|
13241
|
+
_this._bufferService.updateDuration(Infinity).catch(function(e) {
|
|
13242
|
+
});
|
|
13243
|
+
}
|
|
13244
|
+
}
|
|
13245
|
+
});
|
|
12920
13246
|
_defineProperty$3(_assertThisInitialized$2(_this), "_onPlay", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
12921
13247
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
12922
13248
|
while (1)
|
|
@@ -12997,7 +13323,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12997
13323
|
curSeg = _this._playlist.currentSegment;
|
|
12998
13324
|
info = Buffer$1.info(Buffer$1.get(_this.media), seekTime, 0.1);
|
|
12999
13325
|
if (!curSeg) {
|
|
13000
|
-
_context3.next =
|
|
13326
|
+
_context3.next = 17;
|
|
13001
13327
|
break;
|
|
13002
13328
|
}
|
|
13003
13329
|
if (!(info.end && Math.abs(info.end - curSeg.end) < 0.2)) {
|
|
@@ -13006,30 +13332,36 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13006
13332
|
}
|
|
13007
13333
|
return _context3.abrupt("return");
|
|
13008
13334
|
case 15:
|
|
13335
|
+
if (!(_this.isLive && info.end)) {
|
|
13336
|
+
_context3.next = 17;
|
|
13337
|
+
break;
|
|
13338
|
+
}
|
|
13339
|
+
return _context3.abrupt("return");
|
|
13340
|
+
case 17:
|
|
13009
13341
|
segIndex = _this._playlist.findSegmentIndexByTime(seekTime);
|
|
13010
13342
|
seg = _this._playlist.getSegmentByIndex(segIndex);
|
|
13011
13343
|
if (!(segIndex === null || segIndex === void 0 || !seg || _this._segmentProcessing && seg === _this._playlist.nextSegment)) {
|
|
13012
|
-
_context3.next =
|
|
13344
|
+
_context3.next = 21;
|
|
13013
13345
|
break;
|
|
13014
13346
|
}
|
|
13015
13347
|
return _context3.abrupt("return");
|
|
13016
|
-
case
|
|
13348
|
+
case 21:
|
|
13017
13349
|
logger.debug("seek to", seekTime, seg);
|
|
13018
13350
|
_this._playlist.setNextSegmentByIndex(segIndex);
|
|
13019
13351
|
_this._stopTick();
|
|
13020
|
-
_context3.next =
|
|
13352
|
+
_context3.next = 26;
|
|
13021
13353
|
return _this._segmentLoader.cancel();
|
|
13022
|
-
case
|
|
13354
|
+
case 26:
|
|
13023
13355
|
_this._segmentProcessing = false;
|
|
13024
13356
|
if (!(!info.end || _this.isLive)) {
|
|
13025
|
-
_context3.next =
|
|
13357
|
+
_context3.next = 30;
|
|
13026
13358
|
break;
|
|
13027
13359
|
}
|
|
13028
|
-
_context3.next =
|
|
13360
|
+
_context3.next = 30;
|
|
13029
13361
|
return _this._loadSegmentDirect(true);
|
|
13030
|
-
case
|
|
13362
|
+
case 30:
|
|
13031
13363
|
_this._startTick();
|
|
13032
|
-
case
|
|
13364
|
+
case 31:
|
|
13033
13365
|
case "end":
|
|
13034
13366
|
return _context3.stop();
|
|
13035
13367
|
}
|
|
@@ -13079,18 +13411,21 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13079
13411
|
}
|
|
13080
13412
|
return;
|
|
13081
13413
|
}
|
|
13082
|
-
if (Buffer$1.end(buffered)
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
}
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13414
|
+
if (Buffer$1.end(buffered) >= 0.1 && media.readyState) {
|
|
13415
|
+
if (isMediaPlaying(media)) {
|
|
13416
|
+
_this._loadSegment();
|
|
13417
|
+
if (_this._gapService) {
|
|
13418
|
+
_this._gapService.do(media, _this.config.maxJumpDistance, _this.isLive);
|
|
13419
|
+
}
|
|
13420
|
+
} else {
|
|
13421
|
+
if (media.readyState < 2 && _this._gapService) {
|
|
13422
|
+
_this._gapService.do(media, _this.config.maxJumpDistance, !media.currentTime ? true : _this.isLive);
|
|
13423
|
+
}
|
|
13092
13424
|
}
|
|
13093
13425
|
}
|
|
13426
|
+
if (!_this.isLive) {
|
|
13427
|
+
_this._tryEos();
|
|
13428
|
+
}
|
|
13094
13429
|
});
|
|
13095
13430
|
_this.config = _cfg = getConfig(_cfg);
|
|
13096
13431
|
_this.media = _this.config.media;
|
|
@@ -13104,6 +13439,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13104
13439
|
if (!_cfg.softDecode)
|
|
13105
13440
|
_this._gapService = new GapService();
|
|
13106
13441
|
_this._stats = new MediaStatsService(_assertThisInitialized$2(_this), 9e4);
|
|
13442
|
+
_this.media.addEventListener("loadeddata", _this._onLoadeddata);
|
|
13107
13443
|
_this.media.addEventListener("play", _this._onPlay);
|
|
13108
13444
|
_this.media.addEventListener("pause", _this._onPause);
|
|
13109
13445
|
_this.media.addEventListener("seeking", _this._onSeeking);
|
|
@@ -13130,6 +13466,11 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13130
13466
|
get: function get() {
|
|
13131
13467
|
return this._playlist.hasSubtitle;
|
|
13132
13468
|
}
|
|
13469
|
+
}, {
|
|
13470
|
+
key: "totalDuration",
|
|
13471
|
+
get: function get() {
|
|
13472
|
+
return this._playlist.totalDuration;
|
|
13473
|
+
}
|
|
13133
13474
|
}, {
|
|
13134
13475
|
key: "baseDts",
|
|
13135
13476
|
get: function get() {
|
|
@@ -13193,7 +13534,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13193
13534
|
key: "_loadData",
|
|
13194
13535
|
value: function() {
|
|
13195
13536
|
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(url) {
|
|
13196
|
-
var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, startTime, _this$_switchUrlOpts3;
|
|
13537
|
+
var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, preIndex, startTime, _this$_switchUrlOpts3;
|
|
13197
13538
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
13198
13539
|
while (1)
|
|
13199
13540
|
switch (_context5.prev = _context5.next) {
|
|
@@ -13214,7 +13555,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13214
13555
|
case 5:
|
|
13215
13556
|
manifest = _context5.sent;
|
|
13216
13557
|
currentStream = this._playlist.currentStream;
|
|
13217
|
-
if (!this._urlSwitching) {
|
|
13558
|
+
if (!(this._urlSwitching && !this.isLive)) {
|
|
13218
13559
|
_context5.next = 17;
|
|
13219
13560
|
break;
|
|
13220
13561
|
}
|
|
@@ -13233,14 +13574,22 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13233
13574
|
_context5.next = 17;
|
|
13234
13575
|
return this._bufferService.removeBuffer(bufferClearStartPoint);
|
|
13235
13576
|
case 17:
|
|
13577
|
+
if (this._urlSwitching && this.isLive) {
|
|
13578
|
+
preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
|
|
13579
|
+
logger.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
|
|
13580
|
+
if (preIndex === -1) {
|
|
13581
|
+
this._prevSegCc = null;
|
|
13582
|
+
this._prevSegSn = null;
|
|
13583
|
+
}
|
|
13584
|
+
}
|
|
13236
13585
|
if (manifest) {
|
|
13237
|
-
_context5.next =
|
|
13586
|
+
_context5.next = 20;
|
|
13238
13587
|
break;
|
|
13239
13588
|
}
|
|
13240
13589
|
return _context5.abrupt("return");
|
|
13241
|
-
case
|
|
13590
|
+
case 20:
|
|
13242
13591
|
if (!this.isLive) {
|
|
13243
|
-
_context5.next =
|
|
13592
|
+
_context5.next = 31;
|
|
13244
13593
|
break;
|
|
13245
13594
|
}
|
|
13246
13595
|
this._bufferService.setLiveSeekableRange(0, 4294967295);
|
|
@@ -13253,19 +13602,19 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13253
13602
|
if (!manifest.isMaster)
|
|
13254
13603
|
this._pollM3U8(url);
|
|
13255
13604
|
if (!(this._playlist.nbSegments < this.config.minSegmentsStartPlay)) {
|
|
13256
|
-
_context5.next =
|
|
13605
|
+
_context5.next = 28;
|
|
13257
13606
|
break;
|
|
13258
13607
|
}
|
|
13259
13608
|
return _context5.abrupt("return");
|
|
13260
|
-
case
|
|
13261
|
-
_context5.next =
|
|
13609
|
+
case 28:
|
|
13610
|
+
_context5.next = 30;
|
|
13262
13611
|
return this._loadSegment();
|
|
13263
|
-
case 29:
|
|
13264
|
-
return _context5.abrupt("return");
|
|
13265
13612
|
case 30:
|
|
13266
|
-
_context5.
|
|
13613
|
+
return _context5.abrupt("return");
|
|
13614
|
+
case 31:
|
|
13615
|
+
_context5.next = 33;
|
|
13267
13616
|
return this._bufferService.updateDuration(currentStream.totalDuration);
|
|
13268
|
-
case
|
|
13617
|
+
case 33:
|
|
13269
13618
|
startTime = this.config.startTime;
|
|
13270
13619
|
if (startTime) {
|
|
13271
13620
|
if (!((_this$_switchUrlOpts3 = this._switchUrlOpts) !== null && _this$_switchUrlOpts3 !== void 0 && _this$_switchUrlOpts3.seamless)) {
|
|
@@ -13273,9 +13622,9 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13273
13622
|
}
|
|
13274
13623
|
this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(startTime) || 0);
|
|
13275
13624
|
}
|
|
13276
|
-
_context5.next =
|
|
13625
|
+
_context5.next = 37;
|
|
13277
13626
|
return this._loadSegment();
|
|
13278
|
-
case
|
|
13627
|
+
case 37:
|
|
13279
13628
|
case "end":
|
|
13280
13629
|
return _context5.stop();
|
|
13281
13630
|
}
|
|
@@ -13390,20 +13739,22 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13390
13739
|
return _context7.abrupt("return", this.media.play(true));
|
|
13391
13740
|
case 38:
|
|
13392
13741
|
this._urlSwitching = true;
|
|
13393
|
-
this.
|
|
13394
|
-
|
|
13742
|
+
if (!this.isLive) {
|
|
13743
|
+
this._prevSegSn = null;
|
|
13744
|
+
this._prevSegCc = null;
|
|
13745
|
+
}
|
|
13395
13746
|
this._playlist.reset();
|
|
13396
13747
|
this._bufferService.seamlessSwitch();
|
|
13397
|
-
_context7.next =
|
|
13748
|
+
_context7.next = 44;
|
|
13398
13749
|
return this._clear();
|
|
13399
|
-
case
|
|
13400
|
-
_context7.next =
|
|
13750
|
+
case 44:
|
|
13751
|
+
_context7.next = 46;
|
|
13401
13752
|
return this._loadData(url);
|
|
13402
|
-
case
|
|
13753
|
+
case 46:
|
|
13403
13754
|
this._startTick();
|
|
13404
|
-
case
|
|
13755
|
+
case 47:
|
|
13405
13756
|
this._switchUrlOpts = null;
|
|
13406
|
-
case
|
|
13757
|
+
case 48:
|
|
13407
13758
|
case "end":
|
|
13408
13759
|
return _context7.stop();
|
|
13409
13760
|
}
|
|
@@ -13630,15 +13981,16 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13630
13981
|
this._playlist.reset();
|
|
13631
13982
|
this._segmentLoader.reset();
|
|
13632
13983
|
(_this$_seiService2 = this._seiService) === null || _this$_seiService2 === void 0 ? void 0 : _this$_seiService2.reset();
|
|
13984
|
+
this.media.removeEventListener("loadeddata", this._onLoadeddata);
|
|
13633
13985
|
this.media.removeEventListener("play", this._onPlay);
|
|
13634
13986
|
this.media.removeEventListener("pause", this._onPause);
|
|
13635
13987
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
13636
13988
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
13637
|
-
_context11.next =
|
|
13989
|
+
_context11.next = 13;
|
|
13638
13990
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
13639
|
-
case 12:
|
|
13640
|
-
this.media = null;
|
|
13641
13991
|
case 13:
|
|
13992
|
+
this.media = null;
|
|
13993
|
+
case 14:
|
|
13642
13994
|
case "end":
|
|
13643
13995
|
return _context11.stop();
|
|
13644
13996
|
}
|
|
@@ -13775,7 +14127,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13775
14127
|
key: "_loadSegmentDirect",
|
|
13776
14128
|
value: function() {
|
|
13777
14129
|
var _loadSegmentDirect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee13(loadOnce) {
|
|
13778
|
-
var seg, appended, cachedError;
|
|
14130
|
+
var seg, appended, cachedError, _this$_playlist$curre2, bufferEnd, sameStream;
|
|
13779
14131
|
return _regeneratorRuntime$1().wrap(function _callee13$(_context13) {
|
|
13780
14132
|
while (1)
|
|
13781
14133
|
switch (_context13.prev = _context13.next) {
|
|
@@ -13791,7 +14143,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13791
14143
|
cachedError = null;
|
|
13792
14144
|
_context13.prev = 5;
|
|
13793
14145
|
this._segmentProcessing = true;
|
|
13794
|
-
logger.log("load segment, sn:".concat(seg.sn, ", partIndex:").concat(seg.partIndex));
|
|
14146
|
+
logger.log("load segment, sn:".concat(seg.sn, ", [").concat(seg.start, ", ").concat(seg.end, "], partIndex:").concat(seg.partIndex));
|
|
13795
14147
|
_context13.next = 10;
|
|
13796
14148
|
return this._reqAndBufferSegment(seg, this._playlist.getAudioSegment(seg));
|
|
13797
14149
|
case 10:
|
|
@@ -13823,7 +14175,17 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13823
14175
|
return _context13.abrupt("return", this._emitError(StreamingError.create(cachedError)));
|
|
13824
14176
|
case 26:
|
|
13825
14177
|
if (appended) {
|
|
13826
|
-
|
|
14178
|
+
bufferEnd = this.bufferInfo().end;
|
|
14179
|
+
if (this.isLive && !this.media.seeking && bufferEnd && Math.abs(seg.end - bufferEnd) > 1) {
|
|
14180
|
+
logger.warn("segment: ".concat(seg.sn, " expected end=").concat(seg.end, ", real end=").concat(bufferEnd));
|
|
14181
|
+
this._playlist.feedbackLiveEdge(seg, bufferEnd);
|
|
14182
|
+
}
|
|
14183
|
+
sameStream = ((_this$_playlist$curre2 = this._playlist.currentStream) === null || _this$_playlist$curre2 === void 0 ? void 0 : _this$_playlist$curre2.url) === seg.parentUrl;
|
|
14184
|
+
if (this._urlSwitching && !sameStream) {
|
|
14185
|
+
logger.warn("pre playlist segment appended!");
|
|
14186
|
+
this._bufferService.seamlessSwitch();
|
|
14187
|
+
}
|
|
14188
|
+
if (this.isLive && this._urlSwitching && sameStream) {
|
|
13827
14189
|
this._urlSwitching = false;
|
|
13828
14190
|
this.emit(Event$1.SWITCH_URL_SUCCESS, {
|
|
13829
14191
|
url: this.config.url
|
|
@@ -13853,7 +14215,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13853
14215
|
value: function() {
|
|
13854
14216
|
var _reqAndBufferSegment2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee14(seg, audioSeg) {
|
|
13855
14217
|
var _this$_bufferService2;
|
|
13856
|
-
var cc, discontinuity, responses, data, sn, start, stream, before;
|
|
14218
|
+
var cc, discontinuity, responses, data, sn, start, stream, before, contiguous, segStart;
|
|
13857
14219
|
return _regeneratorRuntime$1().wrap(function _callee14$(_context14) {
|
|
13858
14220
|
while (1)
|
|
13859
14221
|
switch (_context14.prev = _context14.next) {
|
|
@@ -13896,20 +14258,27 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13896
14258
|
stream = this._playlist.currentStream;
|
|
13897
14259
|
this._bufferService.createSource(data[0], data[1], stream === null || stream === void 0 ? void 0 : stream.videoCodec, stream === null || stream === void 0 ? void 0 : stream.audioCodec);
|
|
13898
14260
|
before = Date.now();
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
14261
|
+
contiguous = this._prevSegSn === sn - 1;
|
|
14262
|
+
if (this.isLive && this._urlSwitching) {
|
|
14263
|
+
segStart = this.bufferInfo().end;
|
|
14264
|
+
this._playlist.updateSegmentsRanges(sn, segStart);
|
|
14265
|
+
logger.warn("update the new playlist liveEdge, segment id=".concat(sn, ", buffer start=").concat(segStart, ", liveEdge=").concat(this._playlist.liveEdge));
|
|
14266
|
+
start = segStart;
|
|
14267
|
+
}
|
|
14268
|
+
_context14.next = 30;
|
|
14269
|
+
return this._bufferService.appendBuffer(seg, audioSeg, data[0], data[1], discontinuity, contiguous, start);
|
|
14270
|
+
case 30:
|
|
13902
14271
|
this.emit(Event$1.APPEND_COST, {
|
|
13903
14272
|
elapsed: Date.now() - before,
|
|
13904
14273
|
url: seg.url
|
|
13905
14274
|
});
|
|
13906
|
-
_context14.next =
|
|
14275
|
+
_context14.next = 33;
|
|
13907
14276
|
return this._bufferService.evictBuffer(this.config.bufferBehind);
|
|
13908
|
-
case
|
|
14277
|
+
case 33:
|
|
13909
14278
|
this._prevSegCc = cc;
|
|
13910
14279
|
this._prevSegSn = sn;
|
|
13911
14280
|
return _context14.abrupt("return", true);
|
|
13912
|
-
case
|
|
14281
|
+
case 36:
|
|
13913
14282
|
case "end":
|
|
13914
14283
|
return _context14.stop();
|
|
13915
14284
|
}
|
|
@@ -14108,6 +14477,25 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14108
14477
|
}
|
|
14109
14478
|
return nextLoadPoint;
|
|
14110
14479
|
}
|
|
14480
|
+
}, {
|
|
14481
|
+
key: "_tryEos",
|
|
14482
|
+
value: function _tryEos() {
|
|
14483
|
+
var _this$_bufferService3, _this$_bufferService4;
|
|
14484
|
+
var media = this.media;
|
|
14485
|
+
var _this$_playlist = this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
|
|
14486
|
+
var eosAllowed = !nextSegment && media.readyState && media.duration > 0 && ((_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.msIsOpened) && !((_this$_bufferService4 = this._bufferService) !== null && _this$_bufferService4 !== void 0 && _this$_bufferService4.msHasOpTasks);
|
|
14487
|
+
if (!eosAllowed) {
|
|
14488
|
+
return;
|
|
14489
|
+
}
|
|
14490
|
+
var bInfo = this.bufferInfo();
|
|
14491
|
+
if (media.paused && !media.currentTime) {
|
|
14492
|
+
bInfo = this.bufferInfo(bInfo.nextStart || 0.5);
|
|
14493
|
+
}
|
|
14494
|
+
var bufferThroughout = Math.abs(bInfo.end - media.duration) < 0.1 || !this.isLive && lastSegment && bInfo.end >= lastSegment.start + lastSegment.duration;
|
|
14495
|
+
if (bufferThroughout) {
|
|
14496
|
+
this._bufferService.endOfStream();
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14111
14499
|
}], [{
|
|
14112
14500
|
key: "isSupported",
|
|
14113
14501
|
value: function isSupported(mediaType) {
|
|
@@ -14131,7 +14519,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14131
14519
|
}]);
|
|
14132
14520
|
return Hls2;
|
|
14133
14521
|
}(EventEmitter);
|
|
14134
|
-
_defineProperty$3(Hls, "version", "3.0.
|
|
14522
|
+
_defineProperty$3(Hls, "version", "3.0.17");
|
|
14135
14523
|
try {
|
|
14136
14524
|
if (localStorage.getItem("xgd")) {
|
|
14137
14525
|
Hls.enableLogger();
|
|
@@ -14260,17 +14648,22 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
14260
14648
|
(_this$hls2 = _this.hls) === null || _this$hls2 === void 0 ? void 0 : _this$hls2.switchSubtitleStream(lang);
|
|
14261
14649
|
});
|
|
14262
14650
|
_defineProperty$3(_assertThisInitialized$2(_this), "_onSwitchURL", function(url, args) {
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14651
|
+
return new Promise(function(resolve, reject) {
|
|
14652
|
+
var _assertThisInitialize = _assertThisInitialized$2(_this), player = _assertThisInitialize.player, hls = _assertThisInitialize.hls;
|
|
14653
|
+
if (hls) {
|
|
14654
|
+
var _this$player$config, _this$player$config$h;
|
|
14655
|
+
var options = parseSwitchUrlArgs(args, _assertThisInitialized$2(_this));
|
|
14656
|
+
player.config.url = url;
|
|
14657
|
+
hls.switchURL(url, options).then(function() {
|
|
14658
|
+
return resolve(true);
|
|
14659
|
+
}).catch(reject);
|
|
14660
|
+
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) {
|
|
14661
|
+
_this._keepPauseStatus();
|
|
14662
|
+
}
|
|
14663
|
+
} else {
|
|
14664
|
+
reject();
|
|
14272
14665
|
}
|
|
14273
|
-
}
|
|
14666
|
+
});
|
|
14274
14667
|
});
|
|
14275
14668
|
_defineProperty$3(_assertThisInitialized$2(_this), "_keepPauseStatus", function() {
|
|
14276
14669
|
var paused = _this.player.paused;
|
|
@@ -14305,13 +14698,14 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
14305
14698
|
value: function beforePlayerInit() {
|
|
14306
14699
|
var _this2 = this;
|
|
14307
14700
|
var config = this.player.config;
|
|
14308
|
-
|
|
14701
|
+
var hlsOpts = config.hls || {};
|
|
14702
|
+
if (!config.url && !config.__allowHlsEmptyUrl__ || !hlsOpts.preferMMS && MSE.isMMSOnly()) {
|
|
14309
14703
|
return;
|
|
14310
14704
|
}
|
|
14311
14705
|
if (this.hls)
|
|
14312
14706
|
this.hls.destroy();
|
|
14313
14707
|
this.player.switchURL = this._onSwitchURL;
|
|
14314
|
-
|
|
14708
|
+
this.player.handleSource = false;
|
|
14315
14709
|
hlsOpts.innerDegrade = hlsOpts.innerDegrade || config.innerDegrade;
|
|
14316
14710
|
if (hlsOpts.disconnectTime === null || hlsOpts.disconnectTime === void 0)
|
|
14317
14711
|
hlsOpts.disconnectTime = 0;
|
|
@@ -14363,6 +14757,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
14363
14757
|
this._transCoreEvent(EVENT.LOAD_COMPLETE);
|
|
14364
14758
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
14365
14759
|
this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED);
|
|
14760
|
+
this._transCoreEvent(EVENT.MEDIASOURCE_OPENED);
|
|
14366
14761
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
14367
14762
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
14368
14763
|
this._transCoreEvent(EVENT.KEYFRAME);
|