@byteplus/veplayer-plugin 2.3.1-rc.3 → 2.4.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.d.ts +1 -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 +1 -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
|
@@ -486,6 +486,38 @@
|
|
|
486
486
|
return false;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
490
|
+
if (source == null)
|
|
491
|
+
return {};
|
|
492
|
+
var target = {};
|
|
493
|
+
var sourceKeys = Object.keys(source);
|
|
494
|
+
var key, i;
|
|
495
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
496
|
+
key = sourceKeys[i];
|
|
497
|
+
if (excluded.indexOf(key) >= 0)
|
|
498
|
+
continue;
|
|
499
|
+
target[key] = source[key];
|
|
500
|
+
}
|
|
501
|
+
return target;
|
|
502
|
+
}
|
|
503
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
504
|
+
if (source == null)
|
|
505
|
+
return {};
|
|
506
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
507
|
+
var key, i;
|
|
508
|
+
if (Object.getOwnPropertySymbols) {
|
|
509
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
510
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
511
|
+
key = sourceSymbolKeys[i];
|
|
512
|
+
if (excluded.indexOf(key) >= 0)
|
|
513
|
+
continue;
|
|
514
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
515
|
+
continue;
|
|
516
|
+
target[key] = source[key];
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return target;
|
|
520
|
+
}
|
|
489
521
|
function _assertThisInitialized$2(self2) {
|
|
490
522
|
if (self2 === void 0) {
|
|
491
523
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -1461,6 +1493,9 @@
|
|
|
1461
1493
|
_fun && _fun(frameId);
|
|
1462
1494
|
};
|
|
1463
1495
|
util.isMSE = function(video) {
|
|
1496
|
+
if (video.media) {
|
|
1497
|
+
video = video.media;
|
|
1498
|
+
}
|
|
1464
1499
|
if (!video || !(video instanceof HTMLMediaElement)) {
|
|
1465
1500
|
return false;
|
|
1466
1501
|
}
|
|
@@ -1609,7 +1644,7 @@
|
|
|
1609
1644
|
}
|
|
1610
1645
|
return offsetTime;
|
|
1611
1646
|
};
|
|
1612
|
-
var version = "3.0.
|
|
1647
|
+
var version = "3.0.17";
|
|
1613
1648
|
var ERROR_MAP = {
|
|
1614
1649
|
1: 5101,
|
|
1615
1650
|
2: 5102,
|
|
@@ -2713,30 +2748,6 @@
|
|
|
2713
2748
|
var key = _toPrimitive$1(arg, "string");
|
|
2714
2749
|
return typeof key === "symbol" ? key : String(key);
|
|
2715
2750
|
}
|
|
2716
|
-
function createPublicPromise() {
|
|
2717
|
-
var res, rej;
|
|
2718
|
-
var promise = new Promise(function(resolve, reject) {
|
|
2719
|
-
res = resolve;
|
|
2720
|
-
rej = reject;
|
|
2721
|
-
});
|
|
2722
|
-
promise.used = false;
|
|
2723
|
-
promise.resolve = function() {
|
|
2724
|
-
promise.used = true;
|
|
2725
|
-
return res.apply(void 0, arguments);
|
|
2726
|
-
};
|
|
2727
|
-
promise.reject = function() {
|
|
2728
|
-
promise.used = true;
|
|
2729
|
-
return rej.apply(void 0, arguments);
|
|
2730
|
-
};
|
|
2731
|
-
return promise;
|
|
2732
|
-
}
|
|
2733
|
-
function nowTime$1() {
|
|
2734
|
-
try {
|
|
2735
|
-
return parseInt(performance.now(), 10);
|
|
2736
|
-
} catch (e) {
|
|
2737
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
2751
|
var Buffer$1 = /* @__PURE__ */ function() {
|
|
2741
2752
|
function Buffer2() {
|
|
2742
2753
|
_classCallCheck$1(this, Buffer2);
|
|
@@ -2858,6 +2869,7 @@
|
|
|
2858
2869
|
}]);
|
|
2859
2870
|
return Buffer2;
|
|
2860
2871
|
}();
|
|
2872
|
+
var isBrowser$1 = typeof window !== "undefined";
|
|
2861
2873
|
var _ERR_CODE;
|
|
2862
2874
|
var ERR = {
|
|
2863
2875
|
MANIFEST: "manifest",
|
|
@@ -2976,7 +2988,6 @@
|
|
|
2976
2988
|
}]);
|
|
2977
2989
|
return StreamingError2;
|
|
2978
2990
|
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
2979
|
-
var isBrowser$1 = typeof window !== "undefined";
|
|
2980
2991
|
var LogCacheLevel = {
|
|
2981
2992
|
"DEBUG": 1,
|
|
2982
2993
|
"LOG": 2,
|
|
@@ -3005,7 +3016,7 @@
|
|
|
3005
3016
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
3006
3017
|
if (Logger2.disabled)
|
|
3007
3018
|
return;
|
|
3008
|
-
(_console = console).debug.apply(_console, [this._prefix, nowTime()].concat(args));
|
|
3019
|
+
(_console = console).debug.apply(_console, [this._prefix, nowTime$1()].concat(args));
|
|
3009
3020
|
}
|
|
3010
3021
|
}, {
|
|
3011
3022
|
key: "log",
|
|
@@ -3017,7 +3028,7 @@
|
|
|
3017
3028
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
3018
3029
|
if (Logger2.disabled)
|
|
3019
3030
|
return;
|
|
3020
|
-
(_console2 = console).log.apply(_console2, [this._prefix, nowTime()].concat(args));
|
|
3031
|
+
(_console2 = console).log.apply(_console2, [this._prefix, nowTime$1()].concat(args));
|
|
3021
3032
|
}
|
|
3022
3033
|
}, {
|
|
3023
3034
|
key: "warn",
|
|
@@ -3029,7 +3040,7 @@
|
|
|
3029
3040
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
3030
3041
|
if (Logger2.disabled)
|
|
3031
3042
|
return;
|
|
3032
|
-
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime()].concat(args));
|
|
3043
|
+
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime$1()].concat(args));
|
|
3033
3044
|
}
|
|
3034
3045
|
}, {
|
|
3035
3046
|
key: "error",
|
|
@@ -3041,7 +3052,7 @@
|
|
|
3041
3052
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
3042
3053
|
if (Logger2.disabled)
|
|
3043
3054
|
return;
|
|
3044
|
-
(_console4 = console).error.apply(_console4, [this._prefix, nowTime()].concat(args));
|
|
3055
|
+
(_console4 = console).error.apply(_console4, [this._prefix, nowTime$1()].concat(args));
|
|
3045
3056
|
}
|
|
3046
3057
|
}, {
|
|
3047
3058
|
key: "logCache",
|
|
@@ -3056,7 +3067,7 @@
|
|
|
3056
3067
|
var finLogText = logText.map(function(item) {
|
|
3057
3068
|
return logable(item);
|
|
3058
3069
|
});
|
|
3059
|
-
text = this._prefix + nowTime() + JSON.stringify(finLogText);
|
|
3070
|
+
text = this._prefix + nowTime$1() + JSON.stringify(finLogText);
|
|
3060
3071
|
} catch (e) {
|
|
3061
3072
|
return;
|
|
3062
3073
|
}
|
|
@@ -3111,7 +3122,7 @@
|
|
|
3111
3122
|
return Logger2;
|
|
3112
3123
|
}();
|
|
3113
3124
|
_defineProperty$1(Logger$2, "disabled", true);
|
|
3114
|
-
function nowTime() {
|
|
3125
|
+
function nowTime$1() {
|
|
3115
3126
|
return (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3116
3127
|
}
|
|
3117
3128
|
function reduceDepth(val) {
|
|
@@ -3159,13 +3170,72 @@
|
|
|
3159
3170
|
}
|
|
3160
3171
|
return result;
|
|
3161
3172
|
}
|
|
3173
|
+
function createPublicPromise() {
|
|
3174
|
+
var res, rej;
|
|
3175
|
+
var promise = new Promise(function(resolve, reject) {
|
|
3176
|
+
res = resolve;
|
|
3177
|
+
rej = reject;
|
|
3178
|
+
});
|
|
3179
|
+
promise.used = false;
|
|
3180
|
+
promise.resolve = function() {
|
|
3181
|
+
promise.used = true;
|
|
3182
|
+
return res.apply(void 0, arguments);
|
|
3183
|
+
};
|
|
3184
|
+
promise.reject = function() {
|
|
3185
|
+
promise.used = true;
|
|
3186
|
+
return rej.apply(void 0, arguments);
|
|
3187
|
+
};
|
|
3188
|
+
return promise;
|
|
3189
|
+
}
|
|
3190
|
+
function nowTime() {
|
|
3191
|
+
try {
|
|
3192
|
+
return parseInt(performance.now(), 10);
|
|
3193
|
+
} catch (e) {
|
|
3194
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
var SafeJSON = {
|
|
3198
|
+
stringify: function stringify(obj) {
|
|
3199
|
+
try {
|
|
3200
|
+
return JSON.stringify(obj);
|
|
3201
|
+
} catch (e) {
|
|
3202
|
+
return "";
|
|
3203
|
+
}
|
|
3204
|
+
},
|
|
3205
|
+
parse: function parse2(obj) {
|
|
3206
|
+
try {
|
|
3207
|
+
return JSON.parse(obj);
|
|
3208
|
+
} catch (e) {
|
|
3209
|
+
return void 0;
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
};
|
|
3162
3213
|
function getMediaSource() {
|
|
3214
|
+
var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3163
3215
|
try {
|
|
3164
|
-
|
|
3216
|
+
if (!isBrowser$1)
|
|
3217
|
+
return null;
|
|
3218
|
+
if (preferMMS && typeof ManagedMediaSource !== "undefined")
|
|
3219
|
+
return ManagedMediaSource;
|
|
3220
|
+
return window.MediaSource;
|
|
3165
3221
|
} catch (e) {
|
|
3166
3222
|
}
|
|
3167
3223
|
}
|
|
3168
|
-
|
|
3224
|
+
function isMMS(mediaSource) {
|
|
3225
|
+
return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
|
|
3226
|
+
}
|
|
3227
|
+
function getTimeRanges(buffered) {
|
|
3228
|
+
var ranges = [];
|
|
3229
|
+
if (buffered instanceof TimeRanges) {
|
|
3230
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
3231
|
+
ranges.push({
|
|
3232
|
+
start: buffered.start(i),
|
|
3233
|
+
end: buffered.end(i)
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
return ranges;
|
|
3238
|
+
}
|
|
3169
3239
|
var OP_NAME = {
|
|
3170
3240
|
APPEND: "appendBuffer",
|
|
3171
3241
|
REMOVE: "removeBuffer",
|
|
@@ -3186,6 +3256,12 @@
|
|
|
3186
3256
|
_defineProperty$1(this, "_logger", null);
|
|
3187
3257
|
_defineProperty$1(this, "_config", null);
|
|
3188
3258
|
_defineProperty$1(this, "_url", null);
|
|
3259
|
+
_defineProperty$1(this, "_onStartStreaming", function() {
|
|
3260
|
+
_this2._logger.debug("startstreaming");
|
|
3261
|
+
});
|
|
3262
|
+
_defineProperty$1(this, "_onEndStreaming", function() {
|
|
3263
|
+
_this2._logger.debug("endstreaming");
|
|
3264
|
+
});
|
|
3189
3265
|
_defineProperty$1(this, "_onSBUpdateEnd", function(type) {
|
|
3190
3266
|
var queue = _this2._queue[type];
|
|
3191
3267
|
if (queue) {
|
|
@@ -3194,8 +3270,9 @@
|
|
|
3194
3270
|
queue.shift();
|
|
3195
3271
|
}
|
|
3196
3272
|
if (op) {
|
|
3197
|
-
var
|
|
3198
|
-
|
|
3273
|
+
var _this2$_sourceBuffer$;
|
|
3274
|
+
var costtime = nowTime() - _this2._opst;
|
|
3275
|
+
_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);
|
|
3199
3276
|
op.promise.resolve({
|
|
3200
3277
|
name: op.opName,
|
|
3201
3278
|
context: op.context,
|
|
@@ -3229,6 +3306,19 @@
|
|
|
3229
3306
|
var _this$mediaSource;
|
|
3230
3307
|
return ((_this$mediaSource = this.mediaSource) === null || _this$mediaSource === void 0 ? void 0 : _this$mediaSource.readyState) === "open";
|
|
3231
3308
|
}
|
|
3309
|
+
}, {
|
|
3310
|
+
key: "hasOpTasks",
|
|
3311
|
+
get: function get() {
|
|
3312
|
+
var _this3 = this;
|
|
3313
|
+
var flag = false;
|
|
3314
|
+
Object.keys(this._queue).forEach(function(k) {
|
|
3315
|
+
var queue = _this3._queue[k];
|
|
3316
|
+
if (Array.isArray(queue)) {
|
|
3317
|
+
flag || (flag = queue.length > 0);
|
|
3318
|
+
}
|
|
3319
|
+
});
|
|
3320
|
+
return flag;
|
|
3321
|
+
}
|
|
3232
3322
|
}, {
|
|
3233
3323
|
key: "url",
|
|
3234
3324
|
get: function get() {
|
|
@@ -3245,6 +3335,11 @@
|
|
|
3245
3335
|
get: function get() {
|
|
3246
3336
|
return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
|
|
3247
3337
|
}
|
|
3338
|
+
}, {
|
|
3339
|
+
key: "streaming",
|
|
3340
|
+
get: function get() {
|
|
3341
|
+
return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
|
|
3342
|
+
}
|
|
3248
3343
|
}, {
|
|
3249
3344
|
key: "isFull",
|
|
3250
3345
|
value: function isFull(type) {
|
|
@@ -3253,13 +3348,13 @@
|
|
|
3253
3348
|
}, {
|
|
3254
3349
|
key: "updateDuration",
|
|
3255
3350
|
value: function updateDuration(duration) {
|
|
3256
|
-
var
|
|
3351
|
+
var _this4 = this;
|
|
3257
3352
|
var isReduceDuration = this.mediaSource && this.mediaSource.duration > duration;
|
|
3258
3353
|
if (this.mediaSource && this.mediaSource.duration > duration) {
|
|
3259
3354
|
var bufferEnd = 0;
|
|
3260
3355
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3261
3356
|
try {
|
|
3262
|
-
bufferEnd = Math.max(
|
|
3357
|
+
bufferEnd = Math.max(_this4.bufferEnd(k) || 0, bufferEnd);
|
|
3263
3358
|
} catch (error) {
|
|
3264
3359
|
}
|
|
3265
3360
|
});
|
|
@@ -3268,13 +3363,13 @@
|
|
|
3268
3363
|
}
|
|
3269
3364
|
}
|
|
3270
3365
|
return this._enqueueBlockingOp(function() {
|
|
3271
|
-
if (
|
|
3272
|
-
|
|
3366
|
+
if (_this4.isEnded) {
|
|
3367
|
+
_this4._logger.debug("setDuration but ended");
|
|
3273
3368
|
return;
|
|
3274
3369
|
}
|
|
3275
|
-
if (
|
|
3276
|
-
|
|
3277
|
-
|
|
3370
|
+
if (_this4.mediaSource) {
|
|
3371
|
+
_this4.mediaSource.duration = duration;
|
|
3372
|
+
_this4._logger.debug("setDuration", duration);
|
|
3278
3373
|
}
|
|
3279
3374
|
}, OP_NAME.UPDATE_DURATION, {
|
|
3280
3375
|
isReduceDuration
|
|
@@ -3283,15 +3378,15 @@
|
|
|
3283
3378
|
}, {
|
|
3284
3379
|
key: "open",
|
|
3285
3380
|
value: function open() {
|
|
3286
|
-
var
|
|
3381
|
+
var _this5 = this;
|
|
3287
3382
|
if (this._openPromise.used && !this.isOpened && this.mediaSource) {
|
|
3288
3383
|
var ms = this.mediaSource;
|
|
3289
3384
|
var onOpen = function onOpen2() {
|
|
3290
|
-
var
|
|
3291
|
-
|
|
3385
|
+
var costTime = nowTime() - _this5._st;
|
|
3386
|
+
_this5._logger.debug("sourceopen", costTime);
|
|
3292
3387
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3293
|
-
|
|
3294
|
-
costtime
|
|
3388
|
+
_this5._openPromise.resolve({
|
|
3389
|
+
costtime: costTime
|
|
3295
3390
|
});
|
|
3296
3391
|
};
|
|
3297
3392
|
ms.addEventListener("sourceopen", onOpen);
|
|
@@ -3303,8 +3398,8 @@
|
|
|
3303
3398
|
key: "bindMedia",
|
|
3304
3399
|
value: function() {
|
|
3305
3400
|
var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
|
|
3306
|
-
var
|
|
3307
|
-
var ms, onOpen;
|
|
3401
|
+
var _this6 = this;
|
|
3402
|
+
var MediaSource2, ms, useMMS, onOpen;
|
|
3308
3403
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3309
3404
|
while (1)
|
|
3310
3405
|
switch (_context.prev = _context.next) {
|
|
@@ -3316,29 +3411,36 @@
|
|
|
3316
3411
|
_context.next = 3;
|
|
3317
3412
|
return this.unbindMedia();
|
|
3318
3413
|
case 3:
|
|
3319
|
-
|
|
3320
|
-
|
|
3414
|
+
MediaSource2 = getMediaSource(this._config.preferMMS);
|
|
3415
|
+
if (!(!media || !MediaSource2)) {
|
|
3416
|
+
_context.next = 6;
|
|
3321
3417
|
break;
|
|
3322
3418
|
}
|
|
3323
3419
|
throw new Error("Param media or MediaSource does not exist");
|
|
3324
|
-
case
|
|
3420
|
+
case 6:
|
|
3325
3421
|
this.media = media;
|
|
3326
|
-
ms = this.mediaSource = new
|
|
3327
|
-
|
|
3422
|
+
ms = this.mediaSource = new MediaSource2();
|
|
3423
|
+
useMMS = isMMS(ms);
|
|
3424
|
+
this._st = nowTime();
|
|
3328
3425
|
onOpen = function onOpen2() {
|
|
3329
|
-
var
|
|
3330
|
-
|
|
3426
|
+
var costTime = nowTime() - _this6._st;
|
|
3427
|
+
_this6._logger.debug("sourceopen");
|
|
3331
3428
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3332
3429
|
URL.revokeObjectURL(media.src);
|
|
3333
|
-
|
|
3334
|
-
costtime
|
|
3430
|
+
_this6._openPromise.resolve({
|
|
3431
|
+
costtime: costTime
|
|
3335
3432
|
});
|
|
3336
3433
|
};
|
|
3337
3434
|
ms.addEventListener("sourceopen", onOpen);
|
|
3435
|
+
if (useMMS) {
|
|
3436
|
+
ms.addEventListener("startstreaming", this._onStartStreaming);
|
|
3437
|
+
ms.addEventListener("endstreaming", this._onEndStreaming);
|
|
3438
|
+
}
|
|
3338
3439
|
this._url = URL.createObjectURL(ms);
|
|
3339
3440
|
media.src = this._url;
|
|
3441
|
+
media.disableRemotePlayback = useMMS;
|
|
3340
3442
|
return _context.abrupt("return", this._openPromise);
|
|
3341
|
-
case
|
|
3443
|
+
case 17:
|
|
3342
3444
|
case "end":
|
|
3343
3445
|
return _context.stop();
|
|
3344
3446
|
}
|
|
@@ -3353,7 +3455,7 @@
|
|
|
3353
3455
|
key: "unbindMedia",
|
|
3354
3456
|
value: function() {
|
|
3355
3457
|
var _unbindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
|
|
3356
|
-
var
|
|
3458
|
+
var _this7 = this;
|
|
3357
3459
|
var ms, hasMetadata, mseOpen;
|
|
3358
3460
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3359
3461
|
while (1)
|
|
@@ -3364,7 +3466,7 @@
|
|
|
3364
3466
|
ms = this.mediaSource;
|
|
3365
3467
|
if (ms) {
|
|
3366
3468
|
Object.keys(this._queue).forEach(function(t) {
|
|
3367
|
-
var queue =
|
|
3469
|
+
var queue = _this7._queue[t];
|
|
3368
3470
|
if (queue) {
|
|
3369
3471
|
queue.forEach(function(x) {
|
|
3370
3472
|
var _x$promise, _x$promise$resolve;
|
|
@@ -3382,12 +3484,17 @@
|
|
|
3382
3484
|
}
|
|
3383
3485
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3384
3486
|
try {
|
|
3385
|
-
ms.removeSourceBuffer(
|
|
3487
|
+
ms.removeSourceBuffer(_this7._sourceBuffer[k]);
|
|
3386
3488
|
} catch (error) {
|
|
3387
3489
|
}
|
|
3388
3490
|
});
|
|
3491
|
+
if (isMMS(ms)) {
|
|
3492
|
+
ms.removeEventListener("startstreaming", this._onStartStreaming);
|
|
3493
|
+
ms.removeEventListener("endstreaming", this._onEndStreaming);
|
|
3494
|
+
}
|
|
3389
3495
|
}
|
|
3390
3496
|
if (this.media) {
|
|
3497
|
+
this.media.disableRemotePlayback = false;
|
|
3391
3498
|
this.media.removeAttribute("src");
|
|
3392
3499
|
try {
|
|
3393
3500
|
this.media.load();
|
|
@@ -3428,7 +3535,7 @@
|
|
|
3428
3535
|
}, {
|
|
3429
3536
|
key: "changeType",
|
|
3430
3537
|
value: function changeType(type, mimeType) {
|
|
3431
|
-
var
|
|
3538
|
+
var _this8 = this;
|
|
3432
3539
|
var sb = this._sourceBuffer[type];
|
|
3433
3540
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3434
3541
|
return Promise.resolve();
|
|
@@ -3437,7 +3544,7 @@
|
|
|
3437
3544
|
return this._enqueueOp(type, function() {
|
|
3438
3545
|
sb.changeType(mimeType);
|
|
3439
3546
|
sb.mimeType = mimeType;
|
|
3440
|
-
|
|
3547
|
+
_this8._onSBUpdateEnd(type);
|
|
3441
3548
|
}, "changeType", {
|
|
3442
3549
|
mimeType
|
|
3443
3550
|
});
|
|
@@ -3451,60 +3558,60 @@
|
|
|
3451
3558
|
}, {
|
|
3452
3559
|
key: "append",
|
|
3453
3560
|
value: function append(type, buffer, context) {
|
|
3454
|
-
var
|
|
3561
|
+
var _this9 = this;
|
|
3455
3562
|
if (!buffer || !buffer.byteLength) {
|
|
3456
3563
|
return Promise.resolve();
|
|
3457
3564
|
}
|
|
3458
3565
|
if (!this._sourceBuffer[type])
|
|
3459
3566
|
return Promise.resolve();
|
|
3460
3567
|
return this._enqueueOp(type, function() {
|
|
3461
|
-
var
|
|
3462
|
-
if (!
|
|
3568
|
+
var _this9$_sourceBuffer$;
|
|
3569
|
+
if (!_this9.mediaSource || _this9.media.error)
|
|
3463
3570
|
return;
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
(
|
|
3571
|
+
_this9._logger.debug("MSE APPEND START", context);
|
|
3572
|
+
_this9._opst = nowTime();
|
|
3573
|
+
(_this9$_sourceBuffer$ = _this9._sourceBuffer[type]) === null || _this9$_sourceBuffer$ === void 0 ? void 0 : _this9$_sourceBuffer$.appendBuffer(buffer);
|
|
3467
3574
|
}, OP_NAME.APPEND, context);
|
|
3468
3575
|
}
|
|
3469
3576
|
}, {
|
|
3470
3577
|
key: "remove",
|
|
3471
3578
|
value: function remove(type, startTime, endTime, context) {
|
|
3472
|
-
var
|
|
3579
|
+
var _this10 = this;
|
|
3473
3580
|
var isInsertHead = false;
|
|
3474
3581
|
if (this._mseFullFlag[type]) {
|
|
3475
3582
|
isInsertHead = true;
|
|
3476
3583
|
}
|
|
3477
3584
|
return this._enqueueOp(type, function() {
|
|
3478
|
-
if (!
|
|
3585
|
+
if (!_this10.mediaSource || _this10.media.error)
|
|
3479
3586
|
return;
|
|
3480
|
-
var sb =
|
|
3587
|
+
var sb = _this10._sourceBuffer[type];
|
|
3481
3588
|
if (startTime >= endTime || !sb) {
|
|
3482
|
-
|
|
3589
|
+
_this10._onSBUpdateEnd(type);
|
|
3483
3590
|
return;
|
|
3484
3591
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3592
|
+
_this10._opst = nowTime();
|
|
3593
|
+
_this10._logger.debug("MSE REMOVE START", type, startTime, endTime, context);
|
|
3487
3594
|
sb.remove(startTime, endTime);
|
|
3488
3595
|
}, OP_NAME.REMOVE, context, isInsertHead);
|
|
3489
3596
|
}
|
|
3490
3597
|
}, {
|
|
3491
3598
|
key: "clearBuffer",
|
|
3492
3599
|
value: function clearBuffer(startTime, endTime) {
|
|
3493
|
-
var
|
|
3600
|
+
var _this11 = this;
|
|
3494
3601
|
var p;
|
|
3495
3602
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3496
|
-
p =
|
|
3603
|
+
p = _this11.remove(k, startTime, endTime);
|
|
3497
3604
|
});
|
|
3498
3605
|
return p || Promise.resolve();
|
|
3499
3606
|
}
|
|
3500
3607
|
}, {
|
|
3501
3608
|
key: "clearAllBuffer",
|
|
3502
3609
|
value: function clearAllBuffer() {
|
|
3503
|
-
var
|
|
3610
|
+
var _this12 = this;
|
|
3504
3611
|
var p;
|
|
3505
3612
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3506
|
-
var sb =
|
|
3507
|
-
p =
|
|
3613
|
+
var sb = _this12._sourceBuffer[k];
|
|
3614
|
+
p = _this12.remove(k, 0, Buffer$1.end(Buffer$1.get(sb)));
|
|
3508
3615
|
});
|
|
3509
3616
|
return p;
|
|
3510
3617
|
}
|
|
@@ -3520,26 +3627,26 @@
|
|
|
3520
3627
|
}
|
|
3521
3628
|
if (!queue || !queue[type] || queue.length < 5)
|
|
3522
3629
|
return;
|
|
3523
|
-
var
|
|
3630
|
+
var initQueue = [];
|
|
3524
3631
|
queue.forEach(function(op) {
|
|
3525
3632
|
if (op.context && op.context.isinit) {
|
|
3526
|
-
|
|
3633
|
+
initQueue.push(op);
|
|
3527
3634
|
}
|
|
3528
3635
|
});
|
|
3529
3636
|
this._queue[type] = queue.slice(0, 2);
|
|
3530
|
-
|
|
3637
|
+
initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
|
|
3531
3638
|
}
|
|
3532
3639
|
}, {
|
|
3533
3640
|
key: "endOfStream",
|
|
3534
3641
|
value: function endOfStream(reason) {
|
|
3535
|
-
var
|
|
3642
|
+
var _this13 = this;
|
|
3536
3643
|
if (!this.mediaSource || this.mediaSource.readyState !== "open")
|
|
3537
3644
|
return Promise.resolve();
|
|
3538
3645
|
return this._enqueueBlockingOp(function() {
|
|
3539
|
-
var ms =
|
|
3646
|
+
var ms = _this13.mediaSource;
|
|
3540
3647
|
if (!ms || ms.readyState !== "open")
|
|
3541
3648
|
return;
|
|
3542
|
-
|
|
3649
|
+
_this13._logger.debug("MSE endOfStream START");
|
|
3543
3650
|
if (reason) {
|
|
3544
3651
|
ms.endOfStream(reason);
|
|
3545
3652
|
} else {
|
|
@@ -3578,7 +3685,7 @@
|
|
|
3578
3685
|
}, {
|
|
3579
3686
|
key: "_enqueueOp",
|
|
3580
3687
|
value: function _enqueueOp(type, exec, opName, context, isInsertHead) {
|
|
3581
|
-
var
|
|
3688
|
+
var _this14 = this;
|
|
3582
3689
|
if (!this.mediaSource)
|
|
3583
3690
|
return Promise.resolve();
|
|
3584
3691
|
var queue = this._queue[type] = this._queue[type] || [];
|
|
@@ -3602,7 +3709,7 @@
|
|
|
3602
3709
|
} else {
|
|
3603
3710
|
this._openPromise.then(function() {
|
|
3604
3711
|
if (queue.length === 1) {
|
|
3605
|
-
|
|
3712
|
+
_this14._startQueue(type);
|
|
3606
3713
|
}
|
|
3607
3714
|
});
|
|
3608
3715
|
}
|
|
@@ -3612,7 +3719,7 @@
|
|
|
3612
3719
|
key: "_enqueueBlockingOp",
|
|
3613
3720
|
value: function() {
|
|
3614
3721
|
var _enqueueBlockingOp2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(exec, opName, context) {
|
|
3615
|
-
var
|
|
3722
|
+
var _this15 = this;
|
|
3616
3723
|
var types, waiters;
|
|
3617
3724
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3618
3725
|
while (1)
|
|
@@ -3633,7 +3740,7 @@
|
|
|
3633
3740
|
case 5:
|
|
3634
3741
|
waiters = [];
|
|
3635
3742
|
types.forEach(function(t) {
|
|
3636
|
-
var queue =
|
|
3743
|
+
var queue = _this15._queue[t];
|
|
3637
3744
|
var prom = createPublicPromise();
|
|
3638
3745
|
waiters.push(prom);
|
|
3639
3746
|
queue.push({
|
|
@@ -3645,7 +3752,7 @@
|
|
|
3645
3752
|
context
|
|
3646
3753
|
});
|
|
3647
3754
|
if (queue.length === 1) {
|
|
3648
|
-
|
|
3755
|
+
_this15._startQueue(t);
|
|
3649
3756
|
}
|
|
3650
3757
|
});
|
|
3651
3758
|
return _context3.abrupt("return", Promise.all(waiters).then(function() {
|
|
@@ -3653,11 +3760,11 @@
|
|
|
3653
3760
|
return exec();
|
|
3654
3761
|
} finally {
|
|
3655
3762
|
types.forEach(function(t) {
|
|
3656
|
-
var queue =
|
|
3657
|
-
var sb =
|
|
3763
|
+
var queue = _this15._queue[t];
|
|
3764
|
+
var sb = _this15._sourceBuffer[t];
|
|
3658
3765
|
queue === null || queue === void 0 ? void 0 : queue.shift();
|
|
3659
3766
|
if (!sb || !sb.updating) {
|
|
3660
|
-
|
|
3767
|
+
_this15._startQueue(t);
|
|
3661
3768
|
}
|
|
3662
3769
|
});
|
|
3663
3770
|
}
|
|
@@ -3700,47 +3807,54 @@
|
|
|
3700
3807
|
}, {
|
|
3701
3808
|
key: "setTimeoffset",
|
|
3702
3809
|
value: function setTimeoffset(type, timestampOffset, context) {
|
|
3703
|
-
var
|
|
3810
|
+
var _this16 = this;
|
|
3704
3811
|
return this._enqueueOp(type, function() {
|
|
3705
3812
|
if (timestampOffset < 0) {
|
|
3706
3813
|
timestampOffset += 1e-3;
|
|
3707
3814
|
}
|
|
3708
|
-
|
|
3709
|
-
|
|
3815
|
+
_this16._sourceBuffer[type].timestampOffset = timestampOffset;
|
|
3816
|
+
_this16._onSBUpdateEnd(type);
|
|
3710
3817
|
}, "setTimeoffset", context);
|
|
3711
3818
|
}
|
|
3712
3819
|
}, {
|
|
3713
3820
|
key: "abort",
|
|
3714
3821
|
value: function abort(type, context) {
|
|
3715
|
-
var
|
|
3822
|
+
var _this17 = this;
|
|
3716
3823
|
if (!this.isOpened) {
|
|
3717
3824
|
return Promise.resolve();
|
|
3718
3825
|
}
|
|
3719
3826
|
return this._enqueueOp(type, function() {
|
|
3720
|
-
|
|
3721
|
-
|
|
3827
|
+
_this17._sourceBuffer[type].abort();
|
|
3828
|
+
_this17._onSBUpdateEnd(type);
|
|
3722
3829
|
}, "abort", context);
|
|
3723
3830
|
}
|
|
3724
3831
|
}], [{
|
|
3725
|
-
key: "getDefaultConfig",
|
|
3726
|
-
value: function getDefaultConfig() {
|
|
3727
|
-
return {
|
|
3728
|
-
openLog: false
|
|
3729
|
-
};
|
|
3730
|
-
}
|
|
3731
|
-
}, {
|
|
3732
3832
|
key: "isSupported",
|
|
3733
3833
|
value: function isSupported() {
|
|
3734
3834
|
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3735
|
-
|
|
3835
|
+
var MediaSource2 = getMediaSource();
|
|
3836
|
+
if (!MediaSource2)
|
|
3736
3837
|
return false;
|
|
3737
3838
|
try {
|
|
3738
|
-
return
|
|
3839
|
+
return MediaSource2.isTypeSupported(mime);
|
|
3739
3840
|
} catch (error) {
|
|
3740
3841
|
this._logger.error(mime, error);
|
|
3741
3842
|
return false;
|
|
3742
3843
|
}
|
|
3743
3844
|
}
|
|
3845
|
+
}, {
|
|
3846
|
+
key: "isMMSOnly",
|
|
3847
|
+
value: function isMMSOnly() {
|
|
3848
|
+
return typeof ManagedMediaSource !== "undefined" && typeof MediaSource === "undefined";
|
|
3849
|
+
}
|
|
3850
|
+
}, {
|
|
3851
|
+
key: "getDefaultConfig",
|
|
3852
|
+
value: function getDefaultConfig() {
|
|
3853
|
+
return {
|
|
3854
|
+
openLog: false,
|
|
3855
|
+
preferMMS: false
|
|
3856
|
+
};
|
|
3857
|
+
}
|
|
3744
3858
|
}]);
|
|
3745
3859
|
return MSE2;
|
|
3746
3860
|
}();
|
|
@@ -3868,10 +3982,12 @@
|
|
|
3868
3982
|
LOAD_COMPLETE: "core.loadcomplete",
|
|
3869
3983
|
LOAD_RETRY: "core.loadretry",
|
|
3870
3984
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3985
|
+
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3871
3986
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3872
3987
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3873
3988
|
BUFFEREOS: "core.buffereos",
|
|
3874
3989
|
KEYFRAME: "core.keyframe",
|
|
3990
|
+
CHASEFRAME: "core.chaseframe",
|
|
3875
3991
|
METADATA_PARSED: "core.metadataparsed",
|
|
3876
3992
|
SEI: "core.sei",
|
|
3877
3993
|
SEI_IN_TIME: "core.seiintime",
|
|
@@ -4662,7 +4778,7 @@
|
|
|
4662
4778
|
}]);
|
|
4663
4779
|
return XhrLoader2;
|
|
4664
4780
|
}(EventEmitter);
|
|
4665
|
-
var _excluded = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4781
|
+
var _excluded$1 = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4666
4782
|
var Task = /* @__PURE__ */ function() {
|
|
4667
4783
|
function Task2(type, config) {
|
|
4668
4784
|
_classCallCheck$1(this, Task2);
|
|
@@ -4682,7 +4798,7 @@
|
|
|
4682
4798
|
key: "exec",
|
|
4683
4799
|
value: function exec() {
|
|
4684
4800
|
var _this = this;
|
|
4685
|
-
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);
|
|
4801
|
+
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);
|
|
4686
4802
|
var request = /* @__PURE__ */ function() {
|
|
4687
4803
|
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
4688
4804
|
var response, error, isRetry;
|
|
@@ -5518,6 +5634,26 @@
|
|
|
5518
5634
|
this.warnings = [];
|
|
5519
5635
|
this.hvcC = null;
|
|
5520
5636
|
}
|
|
5637
|
+
}, {
|
|
5638
|
+
key: "firstDts",
|
|
5639
|
+
get: function get() {
|
|
5640
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5641
|
+
}
|
|
5642
|
+
}, {
|
|
5643
|
+
key: "firstPts",
|
|
5644
|
+
get: function get() {
|
|
5645
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5646
|
+
}
|
|
5647
|
+
}, {
|
|
5648
|
+
key: "samplesDuration",
|
|
5649
|
+
get: function get() {
|
|
5650
|
+
if (this.samples.length > 0) {
|
|
5651
|
+
var first = this.samples[0];
|
|
5652
|
+
var last = this.samples[this.samples.length - 1];
|
|
5653
|
+
return last.dts - first.dts + last.duration;
|
|
5654
|
+
}
|
|
5655
|
+
return 0;
|
|
5656
|
+
}
|
|
5521
5657
|
}, {
|
|
5522
5658
|
key: "exist",
|
|
5523
5659
|
value: function exist() {
|
|
@@ -5596,6 +5732,26 @@
|
|
|
5596
5732
|
get: function get() {
|
|
5597
5733
|
return this.isAudioEncryption;
|
|
5598
5734
|
}
|
|
5735
|
+
}, {
|
|
5736
|
+
key: "firstDts",
|
|
5737
|
+
get: function get() {
|
|
5738
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5739
|
+
}
|
|
5740
|
+
}, {
|
|
5741
|
+
key: "firstPts",
|
|
5742
|
+
get: function get() {
|
|
5743
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5744
|
+
}
|
|
5745
|
+
}, {
|
|
5746
|
+
key: "samplesDuration",
|
|
5747
|
+
get: function get() {
|
|
5748
|
+
if (this.samples.length > 0) {
|
|
5749
|
+
var first = this.samples[0];
|
|
5750
|
+
var last = this.samples[this.samples.length - 1];
|
|
5751
|
+
return last.dts - first.dts + last.duration;
|
|
5752
|
+
}
|
|
5753
|
+
return 0;
|
|
5754
|
+
}
|
|
5599
5755
|
}]);
|
|
5600
5756
|
return AudioTrack2;
|
|
5601
5757
|
}();
|
|
@@ -6749,7 +6905,11 @@
|
|
|
6749
6905
|
var refSampleDurationInt;
|
|
6750
6906
|
if (videoTrack.fpsNum && videoTrack.fpsDen) {
|
|
6751
6907
|
refSampleDurationInt = videoTrack.timescale * (videoTrack.fpsDen / videoTrack.fpsNum);
|
|
6752
|
-
}
|
|
6908
|
+
}
|
|
6909
|
+
if (refSampleDurationInt < 90 * 10) {
|
|
6910
|
+
refSampleDurationInt = 0;
|
|
6911
|
+
}
|
|
6912
|
+
if (!refSampleDurationInt) {
|
|
6753
6913
|
var first = videoTrack.samples[0];
|
|
6754
6914
|
var second = videoTrack.samples[1];
|
|
6755
6915
|
refSampleDurationInt = len === 1 ? 9e3 : Math.floor(second.dts - first.dts);
|
|
@@ -6864,10 +7024,10 @@
|
|
|
6864
7024
|
}
|
|
6865
7025
|
audioTrack.warnings.push({
|
|
6866
7026
|
type: WarningType.AUDIO_FILLED,
|
|
6867
|
-
pts: sample.pts,
|
|
7027
|
+
pts: sample.pts / 90,
|
|
6868
7028
|
originPts: sample.originPts,
|
|
6869
7029
|
count,
|
|
6870
|
-
nextPts,
|
|
7030
|
+
nextPts: nextPts / 90,
|
|
6871
7031
|
refSampleDuration
|
|
6872
7032
|
});
|
|
6873
7033
|
for (var j = 0; j < count; j++) {
|
|
@@ -6883,9 +7043,9 @@
|
|
|
6883
7043
|
this._lastAudioExceptionOverlapDot = sample.pts;
|
|
6884
7044
|
audioTrack.warnings.push({
|
|
6885
7045
|
type: WarningType.AUDIO_DROPPED,
|
|
6886
|
-
pts: sample.pts,
|
|
7046
|
+
pts: sample.pts / 90,
|
|
6887
7047
|
originPts: sample.originPts,
|
|
6888
|
-
nextPts,
|
|
7048
|
+
nextPts: nextPts / 90,
|
|
6889
7049
|
refSampleDuration
|
|
6890
7050
|
});
|
|
6891
7051
|
}
|
|
@@ -6899,9 +7059,9 @@
|
|
|
6899
7059
|
audioTrack.warnings.push({
|
|
6900
7060
|
type: WarningType.LARGE_AUDIO_GAP,
|
|
6901
7061
|
time: sample.pts / 1e3,
|
|
6902
|
-
pts: sample.pts,
|
|
7062
|
+
pts: sample.pts / 90,
|
|
6903
7063
|
originPts: sample.originPts,
|
|
6904
|
-
nextPts,
|
|
7064
|
+
nextPts: nextPts / 90,
|
|
6905
7065
|
sampleDuration: delta,
|
|
6906
7066
|
refSampleDuration
|
|
6907
7067
|
});
|
|
@@ -7145,6 +7305,23 @@
|
|
|
7145
7305
|
if (!track.pps.length)
|
|
7146
7306
|
track.pps = [unit];
|
|
7147
7307
|
break;
|
|
7308
|
+
case 9:
|
|
7309
|
+
case 35:
|
|
7310
|
+
break;
|
|
7311
|
+
case 38:
|
|
7312
|
+
if (isHevc) {
|
|
7313
|
+
var ffByteFound = false;
|
|
7314
|
+
for (var i = 2; i < unit.byteLength; i++) {
|
|
7315
|
+
if (unit[i] === 255) {
|
|
7316
|
+
ffByteFound = true;
|
|
7317
|
+
break;
|
|
7318
|
+
}
|
|
7319
|
+
}
|
|
7320
|
+
if (!ffByteFound) {
|
|
7321
|
+
return;
|
|
7322
|
+
}
|
|
7323
|
+
}
|
|
7324
|
+
break;
|
|
7148
7325
|
}
|
|
7149
7326
|
sample.units.push(unit);
|
|
7150
7327
|
});
|
|
@@ -7672,6 +7849,7 @@
|
|
|
7672
7849
|
key: "avcC",
|
|
7673
7850
|
value: function avcC(box) {
|
|
7674
7851
|
return parseBox(box, false, function(ret, data) {
|
|
7852
|
+
ret.data = box.data;
|
|
7675
7853
|
ret.configurationVersion = data[0];
|
|
7676
7854
|
ret.AVCProfileIndication = data[1];
|
|
7677
7855
|
ret.profileCompatibility = data[2];
|
|
@@ -10670,6 +10848,20 @@
|
|
|
10670
10848
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.HLS, error);
|
|
10671
10849
|
}
|
|
10672
10850
|
var videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
10851
|
+
var vParsed = {
|
|
10852
|
+
codec: videoTrack.codec,
|
|
10853
|
+
timescale: videoTrack.timescale,
|
|
10854
|
+
firstDts: videoTrack.firstDts / videoTrack.timescale,
|
|
10855
|
+
firstPts: videoTrack.firstPts / videoTrack.timescale,
|
|
10856
|
+
duration: videoTrack.samplesDuration / videoTrack.timescale
|
|
10857
|
+
};
|
|
10858
|
+
var aParsed = {
|
|
10859
|
+
codec: audioTrack.codec,
|
|
10860
|
+
timescale: audioTrack.timescale,
|
|
10861
|
+
firstDts: audioTrack.firstDts / videoTrack.timescale,
|
|
10862
|
+
firstPts: audioTrack.firstPts / videoTrack.timescale,
|
|
10863
|
+
duration: audioTrack.samplesDuration / videoTrack.timescale
|
|
10864
|
+
};
|
|
10673
10865
|
var newId = "".concat(videoTrack.codec, "/").concat(videoTrack.width, "/").concat(videoTrack.height, "/").concat(audioTrack.codec, "/").concat(audioTrack.config);
|
|
10674
10866
|
if (newId !== this._initSegmentId) {
|
|
10675
10867
|
this._initSegmentId = newId;
|
|
@@ -10681,17 +10873,19 @@
|
|
|
10681
10873
|
audioTrack
|
|
10682
10874
|
});
|
|
10683
10875
|
if (this._remuxer) {
|
|
10876
|
+
if (needInit && this.hls.isLive && !this.hls.config.mseLowLatency) {
|
|
10877
|
+
videoTrack.duration = this.hls.totalDuration * videoTrack.timescale;
|
|
10878
|
+
audioTrack.duration = this.hls.totalDuration * audioTrack.timescale;
|
|
10879
|
+
}
|
|
10684
10880
|
try {
|
|
10685
10881
|
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;
|
|
10686
10882
|
var v = concatUint8Array$1(videoInitSegment, videoSegment);
|
|
10687
10883
|
var a = concatUint8Array$1(audioInitSegment, audioSegment);
|
|
10688
|
-
return [v ? {
|
|
10689
|
-
codec: videoTrack.codec,
|
|
10884
|
+
return [v ? _objectSpread2$2(_objectSpread2$2({}, vParsed), {}, {
|
|
10690
10885
|
data: v
|
|
10691
|
-
} : void 0, a ? {
|
|
10692
|
-
codec: audioTrack.codec,
|
|
10886
|
+
}) : void 0, a ? _objectSpread2$2(_objectSpread2$2({}, aParsed), {}, {
|
|
10693
10887
|
data: a
|
|
10694
|
-
} : void 0];
|
|
10888
|
+
}) : void 0];
|
|
10695
10889
|
} catch (error) {
|
|
10696
10890
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, error);
|
|
10697
10891
|
}
|
|
@@ -10703,37 +10897,34 @@
|
|
|
10703
10897
|
key: "_fireEvents",
|
|
10704
10898
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack, discontinuity) {
|
|
10705
10899
|
var _this = this;
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
timescale: audioTrack.timescale,
|
|
10731
|
-
baseDts: audioTrack.baseDts
|
|
10732
|
-
}
|
|
10900
|
+
var tracks = [videoTrack, audioTrack];
|
|
10901
|
+
var logCC = "discontinuity: ".concat(discontinuity);
|
|
10902
|
+
tracks.forEach(function(track) {
|
|
10903
|
+
var _track$samples;
|
|
10904
|
+
if ((_track$samples = track.samples) !== null && _track$samples !== void 0 && _track$samples.length) {
|
|
10905
|
+
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));
|
|
10906
|
+
}
|
|
10907
|
+
if (discontinuity && track.exist()) {
|
|
10908
|
+
_this.hls.emit(Event$1.METADATA_PARSED, {
|
|
10909
|
+
type: track.type,
|
|
10910
|
+
track,
|
|
10911
|
+
meta: _objectSpread2$2({
|
|
10912
|
+
codec: track.codec,
|
|
10913
|
+
timescale: track.timescale,
|
|
10914
|
+
baseDts: track.baseDts
|
|
10915
|
+
}, track.type === TrackType.VIDEO ? {
|
|
10916
|
+
width: track.width,
|
|
10917
|
+
height: track.height,
|
|
10918
|
+
sarRatio: track.sarRatio
|
|
10919
|
+
} : {
|
|
10920
|
+
codec: track.codec,
|
|
10921
|
+
channelCount: track.channelCount,
|
|
10922
|
+
sampleRate: track.sampleRate
|
|
10923
|
+
})
|
|
10733
10924
|
});
|
|
10734
10925
|
}
|
|
10735
|
-
|
|
10736
|
-
|
|
10926
|
+
});
|
|
10927
|
+
logger$3.debug(logCC);
|
|
10737
10928
|
videoTrack.warnings.forEach(function(warn) {
|
|
10738
10929
|
var type;
|
|
10739
10930
|
switch (warn.type) {
|
|
@@ -10793,9 +10984,11 @@
|
|
|
10793
10984
|
}]);
|
|
10794
10985
|
return Transmuxer2;
|
|
10795
10986
|
}();
|
|
10987
|
+
var _excluded = ["data"], _excluded2 = ["data"];
|
|
10796
10988
|
var logger$2 = new Logger$2("BufferService");
|
|
10797
10989
|
var BufferService = /* @__PURE__ */ function() {
|
|
10798
10990
|
function BufferService2(hls) {
|
|
10991
|
+
var _this = this;
|
|
10799
10992
|
_classCallCheck$3(this, BufferService2);
|
|
10800
10993
|
_defineProperty$3(this, "_decryptor", new Decryptor());
|
|
10801
10994
|
_defineProperty$3(this, "_transmuxer", null);
|
|
@@ -10808,9 +11001,13 @@
|
|
|
10808
11001
|
if (hls.config.softDecode) {
|
|
10809
11002
|
this._softVideo = hls.media;
|
|
10810
11003
|
} else {
|
|
10811
|
-
this._mse = new MSE(
|
|
11004
|
+
this._mse = new MSE(null, {
|
|
11005
|
+
preferMMS: hls.config.preferMMS
|
|
11006
|
+
});
|
|
10812
11007
|
if (hls.config.url) {
|
|
10813
|
-
this._mse.bindMedia(hls.media)
|
|
11008
|
+
this._mse.bindMedia(hls.media).then(function(e) {
|
|
11009
|
+
_this.hls.emit(EVENT.MEDIASOURCE_OPENED, e);
|
|
11010
|
+
});
|
|
10814
11011
|
}
|
|
10815
11012
|
}
|
|
10816
11013
|
if (hls.config.decryptor) {
|
|
@@ -10832,11 +11029,23 @@
|
|
|
10832
11029
|
return Object.keys(this._mse._sourceBuffer).length;
|
|
10833
11030
|
}
|
|
10834
11031
|
}, {
|
|
10835
|
-
key: "
|
|
11032
|
+
key: "msIsOpened",
|
|
10836
11033
|
get: function get() {
|
|
10837
11034
|
var _this$_mse2;
|
|
10838
11035
|
return (_this$_mse2 = this._mse) === null || _this$_mse2 === void 0 ? void 0 : _this$_mse2.isOpened;
|
|
10839
11036
|
}
|
|
11037
|
+
}, {
|
|
11038
|
+
key: "msHasOpTasks",
|
|
11039
|
+
get: function get() {
|
|
11040
|
+
var _this$_mse3;
|
|
11041
|
+
return (_this$_mse3 = this._mse) === null || _this$_mse3 === void 0 ? void 0 : _this$_mse3.hasOpTasks;
|
|
11042
|
+
}
|
|
11043
|
+
}, {
|
|
11044
|
+
key: "msStreaming",
|
|
11045
|
+
get: function get() {
|
|
11046
|
+
var _this$_mse4;
|
|
11047
|
+
return (_this$_mse4 = this._mse) === null || _this$_mse4 === void 0 ? void 0 : _this$_mse4.streaming;
|
|
11048
|
+
}
|
|
10840
11049
|
}, {
|
|
10841
11050
|
key: "updateDuration",
|
|
10842
11051
|
value: function() {
|
|
@@ -10941,7 +11150,7 @@
|
|
|
10941
11150
|
key: "appendBuffer",
|
|
10942
11151
|
value: function() {
|
|
10943
11152
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(segment, audioSegment, videoChunk, audioChunk, discontinuity, contiguous, startTime) {
|
|
10944
|
-
var p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p;
|
|
11153
|
+
var p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p, videoData, videoRest, audioData, audioRest;
|
|
10945
11154
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10946
11155
|
while (1)
|
|
10947
11156
|
switch (_context2.prev = _context2.next) {
|
|
@@ -10964,7 +11173,7 @@
|
|
|
10964
11173
|
return _context2.abrupt("return", Promise.all(p));
|
|
10965
11174
|
case 7:
|
|
10966
11175
|
needInit = this._needInitSegment || discontinuity;
|
|
10967
|
-
_this$_transmuxer$tra = this._transmuxer.transmux(videoChunk, audioChunk,
|
|
11176
|
+
_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];
|
|
10968
11177
|
if (audioChunk && audioSegment) {
|
|
10969
11178
|
audioSegment === null || audioSegment === void 0 ? void 0 : audioSegment.setTrackExist(false, true);
|
|
10970
11179
|
}
|
|
@@ -11000,10 +11209,14 @@
|
|
|
11000
11209
|
if (needInit && !isFirstAppend) {
|
|
11001
11210
|
this._handleCodecChange(video, audio);
|
|
11002
11211
|
}
|
|
11003
|
-
if (video)
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11212
|
+
if (video) {
|
|
11213
|
+
videoData = video.data, videoRest = _objectWithoutProperties$1(video, _excluded);
|
|
11214
|
+
_p.push(mse.append(MSE.VIDEO, videoData, videoRest));
|
|
11215
|
+
}
|
|
11216
|
+
if (audio) {
|
|
11217
|
+
audioData = audio.data, audioRest = _objectWithoutProperties$1(audio, _excluded2);
|
|
11218
|
+
_p.push(mse.append(MSE.AUDIO, audioData, audioRest));
|
|
11219
|
+
}
|
|
11007
11220
|
return _context2.abrupt("return", Promise.all(_p));
|
|
11008
11221
|
case 28:
|
|
11009
11222
|
case "end":
|
|
@@ -11020,7 +11233,7 @@
|
|
|
11020
11233
|
key: "removeBuffer",
|
|
11021
11234
|
value: function() {
|
|
11022
11235
|
var _removeBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
11023
|
-
var
|
|
11236
|
+
var _this2 = this;
|
|
11024
11237
|
var start, end, media, _args3 = arguments;
|
|
11025
11238
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
11026
11239
|
while (1)
|
|
@@ -11036,7 +11249,7 @@
|
|
|
11036
11249
|
return _context3.abrupt("return");
|
|
11037
11250
|
case 5:
|
|
11038
11251
|
return _context3.abrupt("return", this._mse.clearBuffer(start, end).then(function() {
|
|
11039
|
-
return
|
|
11252
|
+
return _this2.hls.emit(EVENT.REMOVE_BUFFER, {
|
|
11040
11253
|
start,
|
|
11041
11254
|
end,
|
|
11042
11255
|
removeEnd: end
|
|
@@ -11296,9 +11509,9 @@
|
|
|
11296
11509
|
}, {
|
|
11297
11510
|
key: "isFull",
|
|
11298
11511
|
value: function isFull() {
|
|
11299
|
-
var _this$
|
|
11512
|
+
var _this$_mse5;
|
|
11300
11513
|
var mediaType = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : MSE.VIDEO;
|
|
11301
|
-
return (_this$
|
|
11514
|
+
return (_this$_mse5 = this._mse) === null || _this$_mse5 === void 0 ? void 0 : _this$_mse5.isFull(mediaType);
|
|
11302
11515
|
}
|
|
11303
11516
|
}]);
|
|
11304
11517
|
return BufferService2;
|
|
@@ -11323,7 +11536,10 @@
|
|
|
11323
11536
|
allowedStreamTrackChange: true,
|
|
11324
11537
|
seiInTime: false,
|
|
11325
11538
|
manifestList: [],
|
|
11326
|
-
minSegmentsStartPlay: 3
|
|
11539
|
+
minSegmentsStartPlay: 3,
|
|
11540
|
+
preferMMS: false,
|
|
11541
|
+
preferMMSStreaming: false,
|
|
11542
|
+
mseLowLatency: true
|
|
11327
11543
|
}, cfg), {}, {
|
|
11328
11544
|
media
|
|
11329
11545
|
});
|
|
@@ -11340,6 +11556,12 @@
|
|
|
11340
11556
|
SubTitle: "SUBTITLE",
|
|
11341
11557
|
ClosedCaptions: "CLOSED-CAPTIONS"
|
|
11342
11558
|
};
|
|
11559
|
+
var KeySystems = {
|
|
11560
|
+
CLEAR_KEY: "org.w3.clearkey",
|
|
11561
|
+
FAIRPLAY: "com.apple.streamingkeydelivery",
|
|
11562
|
+
WIDEVINE: "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
|
|
11563
|
+
PLAYREADY: "com.microsoft.playready"
|
|
11564
|
+
};
|
|
11343
11565
|
var MediaStream = /* @__PURE__ */ _createClass$3(function MediaStream2() {
|
|
11344
11566
|
_classCallCheck$3(this, MediaStream2);
|
|
11345
11567
|
_defineProperty$3(this, "id", 0);
|
|
@@ -11423,11 +11645,12 @@
|
|
|
11423
11645
|
_defineProperty$3(this, "segments", []);
|
|
11424
11646
|
});
|
|
11425
11647
|
var MediaSegment = /* @__PURE__ */ function() {
|
|
11426
|
-
function MediaSegment2() {
|
|
11648
|
+
function MediaSegment2(parentUrl) {
|
|
11427
11649
|
_classCallCheck$3(this, MediaSegment2);
|
|
11428
11650
|
_defineProperty$3(this, "sn", 0);
|
|
11429
11651
|
_defineProperty$3(this, "cc", 0);
|
|
11430
11652
|
_defineProperty$3(this, "url", "");
|
|
11653
|
+
_defineProperty$3(this, "parentUrl", "");
|
|
11431
11654
|
_defineProperty$3(this, "title", "");
|
|
11432
11655
|
_defineProperty$3(this, "start", 0);
|
|
11433
11656
|
_defineProperty$3(this, "duration", 0);
|
|
@@ -11441,6 +11664,7 @@
|
|
|
11441
11664
|
_defineProperty$3(this, "hasVideo", false);
|
|
11442
11665
|
_defineProperty$3(this, "independent", false);
|
|
11443
11666
|
_defineProperty$3(this, "partIndex", 0);
|
|
11667
|
+
this.parentUrl = parentUrl;
|
|
11444
11668
|
}
|
|
11445
11669
|
_createClass$3(MediaSegment2, [{
|
|
11446
11670
|
key: "end",
|
|
@@ -11505,6 +11729,38 @@
|
|
|
11505
11729
|
}
|
|
11506
11730
|
}
|
|
11507
11731
|
}
|
|
11732
|
+
}, {
|
|
11733
|
+
key: "isSegmentEncrypted",
|
|
11734
|
+
value: function isSegmentEncrypted() {
|
|
11735
|
+
var method = this.method;
|
|
11736
|
+
return method === "AES-128";
|
|
11737
|
+
}
|
|
11738
|
+
}, {
|
|
11739
|
+
key: "isValidKeySystem",
|
|
11740
|
+
value: function isValidKeySystem() {
|
|
11741
|
+
var isKeyFormatValid = [KeySystems.CLEAR_KEY, KeySystems.FAIRPLAY, KeySystems.WIDEVINE, KeySystems.PLAYREADY].indexOf(this.keyFormat) > -1;
|
|
11742
|
+
if (!isKeyFormatValid) {
|
|
11743
|
+
return false;
|
|
11744
|
+
}
|
|
11745
|
+
var isMethodValid = ["SAMPLE-AES", "SAMPLE-AES-CENC", "SAMPLE-AES-CTR"].indexOf(this.method) > -1;
|
|
11746
|
+
if (!isMethodValid) {
|
|
11747
|
+
return false;
|
|
11748
|
+
}
|
|
11749
|
+
return true;
|
|
11750
|
+
}
|
|
11751
|
+
}, {
|
|
11752
|
+
key: "isSupported",
|
|
11753
|
+
value: function isSupported() {
|
|
11754
|
+
if (!this.method) {
|
|
11755
|
+
return false;
|
|
11756
|
+
}
|
|
11757
|
+
if (this.isSegmentEncrypted()) {
|
|
11758
|
+
return true;
|
|
11759
|
+
} else if (this.isValidKeySystem()) {
|
|
11760
|
+
return true;
|
|
11761
|
+
}
|
|
11762
|
+
return false;
|
|
11763
|
+
}
|
|
11508
11764
|
}]);
|
|
11509
11765
|
return MediaSegmentKey2;
|
|
11510
11766
|
}();
|
|
@@ -11655,7 +11911,7 @@
|
|
|
11655
11911
|
function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
11656
11912
|
var media = new MediaPlaylist();
|
|
11657
11913
|
media.url = parentUrl;
|
|
11658
|
-
var curSegment = new MediaSegment();
|
|
11914
|
+
var curSegment = new MediaSegment(parentUrl);
|
|
11659
11915
|
var curInitSegment = null;
|
|
11660
11916
|
var curKey = null;
|
|
11661
11917
|
var totalDuration = 0;
|
|
@@ -11682,7 +11938,7 @@
|
|
|
11682
11938
|
if (curInitSegment)
|
|
11683
11939
|
curSegment.initSegment = curInitSegment;
|
|
11684
11940
|
media.segments.push(curSegment);
|
|
11685
|
-
curSegment = new MediaSegment();
|
|
11941
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11686
11942
|
curSN++;
|
|
11687
11943
|
continue;
|
|
11688
11944
|
}
|
|
@@ -11761,7 +12017,7 @@
|
|
|
11761
12017
|
if (curInitSegment)
|
|
11762
12018
|
curSegment.initSegment = curInitSegment;
|
|
11763
12019
|
media.segments.push(curSegment);
|
|
11764
|
-
curSegment = new MediaSegment();
|
|
12020
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11765
12021
|
partSegmentIndex++;
|
|
11766
12022
|
}
|
|
11767
12023
|
break;
|
|
@@ -11790,13 +12046,14 @@
|
|
|
11790
12046
|
curKey = null;
|
|
11791
12047
|
break;
|
|
11792
12048
|
}
|
|
11793
|
-
if (_attr3.METHOD !== "AES-128")
|
|
11794
|
-
throw new Error("encrypt ".concat(_attr3.METHOD, "/").concat(_attr3.KEYFORMAT, " is not supported"));
|
|
11795
12049
|
curKey = new MediaSegmentKey();
|
|
11796
12050
|
curKey.method = _attr3.METHOD;
|
|
11797
12051
|
curKey.url = /^blob:/.test(_attr3.URI) ? _attr3.URI : getAbsoluteUrl(_attr3.URI, parentUrl);
|
|
11798
12052
|
curKey.keyFormat = _attr3.KEYFORMAT || "identity";
|
|
11799
12053
|
curKey.keyFormatVersions = _attr3.KEYFORMATVERSIONS;
|
|
12054
|
+
if (!curKey.isSupported()) {
|
|
12055
|
+
throw new Error("encrypt ".concat(_attr3.METHOD, "/").concat(_attr3.KEYFORMAT, " is not supported"));
|
|
12056
|
+
}
|
|
11800
12057
|
if (_attr3.IV) {
|
|
11801
12058
|
var str = _attr3.IV.slice(2);
|
|
11802
12059
|
str = (str.length & 1 ? "0" : "") + str;
|
|
@@ -11819,7 +12076,7 @@
|
|
|
11819
12076
|
curSegment.key = curKey.clone(0);
|
|
11820
12077
|
}
|
|
11821
12078
|
curInitSegment = curSegment;
|
|
11822
|
-
curSegment = new MediaSegment();
|
|
12079
|
+
curSegment = new MediaSegment(parentUrl);
|
|
11823
12080
|
}
|
|
11824
12081
|
break;
|
|
11825
12082
|
}
|
|
@@ -11831,6 +12088,9 @@
|
|
|
11831
12088
|
if (lastSegment) {
|
|
11832
12089
|
media.endSN = lastSegment.sn;
|
|
11833
12090
|
media.endPartIndex = lastSegment.partIndex;
|
|
12091
|
+
if (endOfList && !lastSegment.isLast) {
|
|
12092
|
+
lastSegment.isLast = true;
|
|
12093
|
+
}
|
|
11834
12094
|
}
|
|
11835
12095
|
media.totalDuration = totalDuration;
|
|
11836
12096
|
media.endCC = curCC;
|
|
@@ -12182,12 +12442,20 @@
|
|
|
12182
12442
|
key: "liveEdge",
|
|
12183
12443
|
get: function get() {
|
|
12184
12444
|
return this.endTime;
|
|
12445
|
+
},
|
|
12446
|
+
set: function set(end) {
|
|
12447
|
+
this.endTime = end;
|
|
12185
12448
|
}
|
|
12186
12449
|
}, {
|
|
12187
12450
|
key: "endTime",
|
|
12188
12451
|
get: function get() {
|
|
12189
12452
|
var _this$lastSegment;
|
|
12190
12453
|
return ((_this$lastSegment = this.lastSegment) === null || _this$lastSegment === void 0 ? void 0 : _this$lastSegment.end) || 0;
|
|
12454
|
+
},
|
|
12455
|
+
set: function set(end) {
|
|
12456
|
+
var lastSeg = this.lastSegment;
|
|
12457
|
+
if (lastSeg)
|
|
12458
|
+
lastSeg.duration = end - lastSeg.start;
|
|
12191
12459
|
}
|
|
12192
12460
|
}, {
|
|
12193
12461
|
key: "currentSubtitleEndSn",
|
|
@@ -12354,9 +12622,10 @@
|
|
|
12354
12622
|
value: function _updateSegments(playlist, segObj) {
|
|
12355
12623
|
var segments = segObj.segments;
|
|
12356
12624
|
if (this.live) {
|
|
12625
|
+
var _endSeg$sn;
|
|
12357
12626
|
var lowLatency = playlist.lowLatency;
|
|
12358
12627
|
var endSeg = segments[segments.length - 1];
|
|
12359
|
-
var endSN = (endSeg === null || endSeg === void 0 ? void 0 : endSeg.sn)
|
|
12628
|
+
var endSN = (_endSeg$sn = endSeg === null || endSeg === void 0 ? void 0 : endSeg.sn) !== null && _endSeg$sn !== void 0 ? _endSeg$sn : -1;
|
|
12360
12629
|
var endPartIndex = (endSeg === null || endSeg === void 0 ? void 0 : endSeg.partIndex) || 0;
|
|
12361
12630
|
var hasNew = endSN < playlist.endSN && playlist.segments.length;
|
|
12362
12631
|
if (lowLatency) {
|
|
@@ -12444,6 +12713,11 @@
|
|
|
12444
12713
|
get: function get() {
|
|
12445
12714
|
var _this$currentStream5;
|
|
12446
12715
|
return (_this$currentStream5 = this.currentStream) === null || _this$currentStream5 === void 0 ? void 0 : _this$currentStream5.liveEdge;
|
|
12716
|
+
},
|
|
12717
|
+
set: function set(end) {
|
|
12718
|
+
if (this.currentStream) {
|
|
12719
|
+
this.currentStream.liveEdge = end;
|
|
12720
|
+
}
|
|
12447
12721
|
}
|
|
12448
12722
|
}, {
|
|
12449
12723
|
key: "totalDuration",
|
|
@@ -12522,6 +12796,19 @@
|
|
|
12522
12796
|
var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
12523
12797
|
this._segmentPointer = index - 1;
|
|
12524
12798
|
}
|
|
12799
|
+
}, {
|
|
12800
|
+
key: "setNextSegmentBySN",
|
|
12801
|
+
value: function setNextSegmentBySN() {
|
|
12802
|
+
var _this$currentSegments7;
|
|
12803
|
+
var sn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
12804
|
+
var preIndex = (_this$currentSegments7 = this.currentSegments) === null || _this$currentSegments7 === void 0 ? void 0 : _this$currentSegments7.findIndex(function(x) {
|
|
12805
|
+
return x.sn === sn;
|
|
12806
|
+
});
|
|
12807
|
+
if (preIndex !== -1) {
|
|
12808
|
+
this.setNextSegmentByIndex(preIndex + 1);
|
|
12809
|
+
}
|
|
12810
|
+
return preIndex;
|
|
12811
|
+
}
|
|
12525
12812
|
}, {
|
|
12526
12813
|
key: "findSegmentIndexByTime",
|
|
12527
12814
|
value: function findSegmentIndexByTime(time) {
|
|
@@ -12581,6 +12868,18 @@
|
|
|
12581
12868
|
}
|
|
12582
12869
|
}
|
|
12583
12870
|
}
|
|
12871
|
+
}, {
|
|
12872
|
+
key: "updateSegmentsRanges",
|
|
12873
|
+
value: function updateSegmentsRanges(sn, start) {
|
|
12874
|
+
var _this$currentSegments8;
|
|
12875
|
+
var segs = (_this$currentSegments8 = this.currentSegments) === null || _this$currentSegments8 === void 0 ? void 0 : _this$currentSegments8.filter(function(x) {
|
|
12876
|
+
return x.sn >= sn;
|
|
12877
|
+
});
|
|
12878
|
+
segs.forEach(function(s) {
|
|
12879
|
+
s.start = start;
|
|
12880
|
+
start = s.end;
|
|
12881
|
+
});
|
|
12882
|
+
}
|
|
12584
12883
|
}, {
|
|
12585
12884
|
key: "switchSubtitle",
|
|
12586
12885
|
value: function switchSubtitle(lang) {
|
|
@@ -12623,6 +12922,20 @@
|
|
|
12623
12922
|
if (next.hasAudio !== seg.hasAudio || next.hasVideo !== seg.hasVideo)
|
|
12624
12923
|
return next;
|
|
12625
12924
|
}
|
|
12925
|
+
}, {
|
|
12926
|
+
key: "feedbackLiveEdge",
|
|
12927
|
+
value: function feedbackLiveEdge(segment, bufferEnd) {
|
|
12928
|
+
var _this$lastSegment;
|
|
12929
|
+
var segs = this.currentSegments;
|
|
12930
|
+
if (!segs)
|
|
12931
|
+
return;
|
|
12932
|
+
var isLast = ((_this$lastSegment = this.lastSegment) === null || _this$lastSegment === void 0 ? void 0 : _this$lastSegment.sn) === segment.sn;
|
|
12933
|
+
if (isLast) {
|
|
12934
|
+
this.liveEdge = bufferEnd;
|
|
12935
|
+
return;
|
|
12936
|
+
}
|
|
12937
|
+
this.updateSegmentsRanges(segment.sn + 1, bufferEnd);
|
|
12938
|
+
}
|
|
12626
12939
|
}]);
|
|
12627
12940
|
return Playlist2;
|
|
12628
12941
|
}();
|
|
@@ -12767,7 +13080,7 @@
|
|
|
12767
13080
|
}
|
|
12768
13081
|
}
|
|
12769
13082
|
keyUrl = (_seg$key = seg.key) === null || _seg$key === void 0 ? void 0 : _seg$key.url;
|
|
12770
|
-
if (keyUrl) {
|
|
13083
|
+
if (keyUrl && seg.key.isSegmentEncrypted()) {
|
|
12771
13084
|
keyIv = seg.key.iv;
|
|
12772
13085
|
key = this._keyCache[keyUrl];
|
|
12773
13086
|
if (!key) {
|
|
@@ -12874,7 +13187,7 @@
|
|
|
12874
13187
|
_defineProperty$3(_assertThisInitialized$2(_this), "_switchUrlOpts", null);
|
|
12875
13188
|
_defineProperty$3(_assertThisInitialized$2(_this), "_isProcessQuotaExceeded", false);
|
|
12876
13189
|
_defineProperty$3(_assertThisInitialized$2(_this), "_loadSegment", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
12877
|
-
var nextSeg, bInfo, bufferThroughout;
|
|
13190
|
+
var nextSeg, _assertThisInitialize, config, bInfo, bufferThroughout;
|
|
12878
13191
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
12879
13192
|
while (1)
|
|
12880
13193
|
switch (_context.prev = _context.next) {
|
|
@@ -12886,14 +13199,15 @@
|
|
|
12886
13199
|
return _context.abrupt("return");
|
|
12887
13200
|
case 2:
|
|
12888
13201
|
nextSeg = _this._playlist.nextSegment;
|
|
13202
|
+
_assertThisInitialize = _assertThisInitialized$2(_this), config = _assertThisInitialize.config;
|
|
12889
13203
|
if (nextSeg) {
|
|
12890
|
-
_context.next =
|
|
13204
|
+
_context.next = 6;
|
|
12891
13205
|
break;
|
|
12892
13206
|
}
|
|
12893
13207
|
return _context.abrupt("return");
|
|
12894
|
-
case
|
|
13208
|
+
case 6:
|
|
12895
13209
|
if (_this.isLive) {
|
|
12896
|
-
_context.next =
|
|
13210
|
+
_context.next = 16;
|
|
12897
13211
|
break;
|
|
12898
13212
|
}
|
|
12899
13213
|
bInfo = _this.bufferInfo();
|
|
@@ -12901,26 +13215,38 @@
|
|
|
12901
13215
|
bInfo = _this.bufferInfo(bInfo.nextStart || 0.5);
|
|
12902
13216
|
}
|
|
12903
13217
|
bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < 0.1;
|
|
12904
|
-
if (!(bInfo.remaining >=
|
|
12905
|
-
_context.next =
|
|
13218
|
+
if (!(bInfo.remaining >= config.preloadTime || bufferThroughout)) {
|
|
13219
|
+
_context.next = 13;
|
|
12906
13220
|
break;
|
|
12907
13221
|
}
|
|
12908
|
-
|
|
12909
|
-
|
|
13222
|
+
_this._tryEos();
|
|
13223
|
+
return _context.abrupt("return");
|
|
13224
|
+
case 13:
|
|
13225
|
+
if (!(config.preferMMSStreaming && !_this._bufferService.msStreaming)) {
|
|
13226
|
+
_context.next = 15;
|
|
13227
|
+
break;
|
|
12910
13228
|
}
|
|
12911
13229
|
return _context.abrupt("return");
|
|
12912
|
-
case
|
|
13230
|
+
case 15:
|
|
12913
13231
|
if (!_this._urlSwitching && _this._prevSegSn !== nextSeg.sn - 1 && bInfo.end && Math.abs(nextSeg.start - bInfo.end) > 1) {
|
|
12914
13232
|
_this._playlist.setNextSegmentByIndex(_this._playlist.findSegmentIndexByTime(bInfo.end + 0.1));
|
|
12915
13233
|
}
|
|
12916
|
-
case
|
|
13234
|
+
case 16:
|
|
12917
13235
|
return _context.abrupt("return", _this._loadSegmentDirect());
|
|
12918
|
-
case
|
|
13236
|
+
case 17:
|
|
12919
13237
|
case "end":
|
|
12920
13238
|
return _context.stop();
|
|
12921
13239
|
}
|
|
12922
13240
|
}, _callee);
|
|
12923
13241
|
})));
|
|
13242
|
+
_defineProperty$3(_assertThisInitialized$2(_this), "_onLoadeddata", function() {
|
|
13243
|
+
if (_this.isLive && !_this.config.mseLowLatency) {
|
|
13244
|
+
if (_this.media.duration !== Infinity) {
|
|
13245
|
+
_this._bufferService.updateDuration(Infinity).catch(function(e) {
|
|
13246
|
+
});
|
|
13247
|
+
}
|
|
13248
|
+
}
|
|
13249
|
+
});
|
|
12924
13250
|
_defineProperty$3(_assertThisInitialized$2(_this), "_onPlay", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
12925
13251
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
12926
13252
|
while (1)
|
|
@@ -13001,7 +13327,7 @@
|
|
|
13001
13327
|
curSeg = _this._playlist.currentSegment;
|
|
13002
13328
|
info = Buffer$1.info(Buffer$1.get(_this.media), seekTime, 0.1);
|
|
13003
13329
|
if (!curSeg) {
|
|
13004
|
-
_context3.next =
|
|
13330
|
+
_context3.next = 17;
|
|
13005
13331
|
break;
|
|
13006
13332
|
}
|
|
13007
13333
|
if (!(info.end && Math.abs(info.end - curSeg.end) < 0.2)) {
|
|
@@ -13010,30 +13336,36 @@
|
|
|
13010
13336
|
}
|
|
13011
13337
|
return _context3.abrupt("return");
|
|
13012
13338
|
case 15:
|
|
13339
|
+
if (!(_this.isLive && info.end)) {
|
|
13340
|
+
_context3.next = 17;
|
|
13341
|
+
break;
|
|
13342
|
+
}
|
|
13343
|
+
return _context3.abrupt("return");
|
|
13344
|
+
case 17:
|
|
13013
13345
|
segIndex = _this._playlist.findSegmentIndexByTime(seekTime);
|
|
13014
13346
|
seg = _this._playlist.getSegmentByIndex(segIndex);
|
|
13015
13347
|
if (!(segIndex === null || segIndex === void 0 || !seg || _this._segmentProcessing && seg === _this._playlist.nextSegment)) {
|
|
13016
|
-
_context3.next =
|
|
13348
|
+
_context3.next = 21;
|
|
13017
13349
|
break;
|
|
13018
13350
|
}
|
|
13019
13351
|
return _context3.abrupt("return");
|
|
13020
|
-
case
|
|
13352
|
+
case 21:
|
|
13021
13353
|
logger.debug("seek to", seekTime, seg);
|
|
13022
13354
|
_this._playlist.setNextSegmentByIndex(segIndex);
|
|
13023
13355
|
_this._stopTick();
|
|
13024
|
-
_context3.next =
|
|
13356
|
+
_context3.next = 26;
|
|
13025
13357
|
return _this._segmentLoader.cancel();
|
|
13026
|
-
case
|
|
13358
|
+
case 26:
|
|
13027
13359
|
_this._segmentProcessing = false;
|
|
13028
13360
|
if (!(!info.end || _this.isLive)) {
|
|
13029
|
-
_context3.next =
|
|
13361
|
+
_context3.next = 30;
|
|
13030
13362
|
break;
|
|
13031
13363
|
}
|
|
13032
|
-
_context3.next =
|
|
13364
|
+
_context3.next = 30;
|
|
13033
13365
|
return _this._loadSegmentDirect(true);
|
|
13034
|
-
case
|
|
13366
|
+
case 30:
|
|
13035
13367
|
_this._startTick();
|
|
13036
|
-
case
|
|
13368
|
+
case 31:
|
|
13037
13369
|
case "end":
|
|
13038
13370
|
return _context3.stop();
|
|
13039
13371
|
}
|
|
@@ -13083,18 +13415,21 @@
|
|
|
13083
13415
|
}
|
|
13084
13416
|
return;
|
|
13085
13417
|
}
|
|
13086
|
-
if (Buffer$1.end(buffered)
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
}
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13418
|
+
if (Buffer$1.end(buffered) >= 0.1 && media.readyState) {
|
|
13419
|
+
if (isMediaPlaying(media)) {
|
|
13420
|
+
_this._loadSegment();
|
|
13421
|
+
if (_this._gapService) {
|
|
13422
|
+
_this._gapService.do(media, _this.config.maxJumpDistance, _this.isLive);
|
|
13423
|
+
}
|
|
13424
|
+
} else {
|
|
13425
|
+
if (media.readyState < 2 && _this._gapService) {
|
|
13426
|
+
_this._gapService.do(media, _this.config.maxJumpDistance, !media.currentTime ? true : _this.isLive);
|
|
13427
|
+
}
|
|
13096
13428
|
}
|
|
13097
13429
|
}
|
|
13430
|
+
if (!_this.isLive) {
|
|
13431
|
+
_this._tryEos();
|
|
13432
|
+
}
|
|
13098
13433
|
});
|
|
13099
13434
|
_this.config = _cfg = getConfig(_cfg);
|
|
13100
13435
|
_this.media = _this.config.media;
|
|
@@ -13108,6 +13443,7 @@
|
|
|
13108
13443
|
if (!_cfg.softDecode)
|
|
13109
13444
|
_this._gapService = new GapService();
|
|
13110
13445
|
_this._stats = new MediaStatsService(_assertThisInitialized$2(_this), 9e4);
|
|
13446
|
+
_this.media.addEventListener("loadeddata", _this._onLoadeddata);
|
|
13111
13447
|
_this.media.addEventListener("play", _this._onPlay);
|
|
13112
13448
|
_this.media.addEventListener("pause", _this._onPause);
|
|
13113
13449
|
_this.media.addEventListener("seeking", _this._onSeeking);
|
|
@@ -13134,6 +13470,11 @@
|
|
|
13134
13470
|
get: function get() {
|
|
13135
13471
|
return this._playlist.hasSubtitle;
|
|
13136
13472
|
}
|
|
13473
|
+
}, {
|
|
13474
|
+
key: "totalDuration",
|
|
13475
|
+
get: function get() {
|
|
13476
|
+
return this._playlist.totalDuration;
|
|
13477
|
+
}
|
|
13137
13478
|
}, {
|
|
13138
13479
|
key: "baseDts",
|
|
13139
13480
|
get: function get() {
|
|
@@ -13197,7 +13538,7 @@
|
|
|
13197
13538
|
key: "_loadData",
|
|
13198
13539
|
value: function() {
|
|
13199
13540
|
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(url) {
|
|
13200
|
-
var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, startTime, _this$_switchUrlOpts3;
|
|
13541
|
+
var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, preIndex, startTime, _this$_switchUrlOpts3;
|
|
13201
13542
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
13202
13543
|
while (1)
|
|
13203
13544
|
switch (_context5.prev = _context5.next) {
|
|
@@ -13218,7 +13559,7 @@
|
|
|
13218
13559
|
case 5:
|
|
13219
13560
|
manifest = _context5.sent;
|
|
13220
13561
|
currentStream = this._playlist.currentStream;
|
|
13221
|
-
if (!this._urlSwitching) {
|
|
13562
|
+
if (!(this._urlSwitching && !this.isLive)) {
|
|
13222
13563
|
_context5.next = 17;
|
|
13223
13564
|
break;
|
|
13224
13565
|
}
|
|
@@ -13237,14 +13578,22 @@
|
|
|
13237
13578
|
_context5.next = 17;
|
|
13238
13579
|
return this._bufferService.removeBuffer(bufferClearStartPoint);
|
|
13239
13580
|
case 17:
|
|
13581
|
+
if (this._urlSwitching && this.isLive) {
|
|
13582
|
+
preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
|
|
13583
|
+
logger.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
|
|
13584
|
+
if (preIndex === -1) {
|
|
13585
|
+
this._prevSegCc = null;
|
|
13586
|
+
this._prevSegSn = null;
|
|
13587
|
+
}
|
|
13588
|
+
}
|
|
13240
13589
|
if (manifest) {
|
|
13241
|
-
_context5.next =
|
|
13590
|
+
_context5.next = 20;
|
|
13242
13591
|
break;
|
|
13243
13592
|
}
|
|
13244
13593
|
return _context5.abrupt("return");
|
|
13245
|
-
case
|
|
13594
|
+
case 20:
|
|
13246
13595
|
if (!this.isLive) {
|
|
13247
|
-
_context5.next =
|
|
13596
|
+
_context5.next = 31;
|
|
13248
13597
|
break;
|
|
13249
13598
|
}
|
|
13250
13599
|
this._bufferService.setLiveSeekableRange(0, 4294967295);
|
|
@@ -13257,19 +13606,19 @@
|
|
|
13257
13606
|
if (!manifest.isMaster)
|
|
13258
13607
|
this._pollM3U8(url);
|
|
13259
13608
|
if (!(this._playlist.nbSegments < this.config.minSegmentsStartPlay)) {
|
|
13260
|
-
_context5.next =
|
|
13609
|
+
_context5.next = 28;
|
|
13261
13610
|
break;
|
|
13262
13611
|
}
|
|
13263
13612
|
return _context5.abrupt("return");
|
|
13264
|
-
case
|
|
13265
|
-
_context5.next =
|
|
13613
|
+
case 28:
|
|
13614
|
+
_context5.next = 30;
|
|
13266
13615
|
return this._loadSegment();
|
|
13267
|
-
case 29:
|
|
13268
|
-
return _context5.abrupt("return");
|
|
13269
13616
|
case 30:
|
|
13270
|
-
_context5.
|
|
13617
|
+
return _context5.abrupt("return");
|
|
13618
|
+
case 31:
|
|
13619
|
+
_context5.next = 33;
|
|
13271
13620
|
return this._bufferService.updateDuration(currentStream.totalDuration);
|
|
13272
|
-
case
|
|
13621
|
+
case 33:
|
|
13273
13622
|
startTime = this.config.startTime;
|
|
13274
13623
|
if (startTime) {
|
|
13275
13624
|
if (!((_this$_switchUrlOpts3 = this._switchUrlOpts) !== null && _this$_switchUrlOpts3 !== void 0 && _this$_switchUrlOpts3.seamless)) {
|
|
@@ -13277,9 +13626,9 @@
|
|
|
13277
13626
|
}
|
|
13278
13627
|
this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(startTime) || 0);
|
|
13279
13628
|
}
|
|
13280
|
-
_context5.next =
|
|
13629
|
+
_context5.next = 37;
|
|
13281
13630
|
return this._loadSegment();
|
|
13282
|
-
case
|
|
13631
|
+
case 37:
|
|
13283
13632
|
case "end":
|
|
13284
13633
|
return _context5.stop();
|
|
13285
13634
|
}
|
|
@@ -13394,20 +13743,22 @@
|
|
|
13394
13743
|
return _context7.abrupt("return", this.media.play(true));
|
|
13395
13744
|
case 38:
|
|
13396
13745
|
this._urlSwitching = true;
|
|
13397
|
-
this.
|
|
13398
|
-
|
|
13746
|
+
if (!this.isLive) {
|
|
13747
|
+
this._prevSegSn = null;
|
|
13748
|
+
this._prevSegCc = null;
|
|
13749
|
+
}
|
|
13399
13750
|
this._playlist.reset();
|
|
13400
13751
|
this._bufferService.seamlessSwitch();
|
|
13401
|
-
_context7.next =
|
|
13752
|
+
_context7.next = 44;
|
|
13402
13753
|
return this._clear();
|
|
13403
|
-
case
|
|
13404
|
-
_context7.next =
|
|
13754
|
+
case 44:
|
|
13755
|
+
_context7.next = 46;
|
|
13405
13756
|
return this._loadData(url);
|
|
13406
|
-
case
|
|
13757
|
+
case 46:
|
|
13407
13758
|
this._startTick();
|
|
13408
|
-
case
|
|
13759
|
+
case 47:
|
|
13409
13760
|
this._switchUrlOpts = null;
|
|
13410
|
-
case
|
|
13761
|
+
case 48:
|
|
13411
13762
|
case "end":
|
|
13412
13763
|
return _context7.stop();
|
|
13413
13764
|
}
|
|
@@ -13634,15 +13985,16 @@
|
|
|
13634
13985
|
this._playlist.reset();
|
|
13635
13986
|
this._segmentLoader.reset();
|
|
13636
13987
|
(_this$_seiService2 = this._seiService) === null || _this$_seiService2 === void 0 ? void 0 : _this$_seiService2.reset();
|
|
13988
|
+
this.media.removeEventListener("loadeddata", this._onLoadeddata);
|
|
13637
13989
|
this.media.removeEventListener("play", this._onPlay);
|
|
13638
13990
|
this.media.removeEventListener("pause", this._onPause);
|
|
13639
13991
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
13640
13992
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
13641
|
-
_context11.next =
|
|
13993
|
+
_context11.next = 13;
|
|
13642
13994
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
13643
|
-
case 12:
|
|
13644
|
-
this.media = null;
|
|
13645
13995
|
case 13:
|
|
13996
|
+
this.media = null;
|
|
13997
|
+
case 14:
|
|
13646
13998
|
case "end":
|
|
13647
13999
|
return _context11.stop();
|
|
13648
14000
|
}
|
|
@@ -13779,7 +14131,7 @@
|
|
|
13779
14131
|
key: "_loadSegmentDirect",
|
|
13780
14132
|
value: function() {
|
|
13781
14133
|
var _loadSegmentDirect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee13(loadOnce) {
|
|
13782
|
-
var seg, appended, cachedError;
|
|
14134
|
+
var seg, appended, cachedError, _this$_playlist$curre2, bufferEnd, sameStream;
|
|
13783
14135
|
return _regeneratorRuntime$1().wrap(function _callee13$(_context13) {
|
|
13784
14136
|
while (1)
|
|
13785
14137
|
switch (_context13.prev = _context13.next) {
|
|
@@ -13795,7 +14147,7 @@
|
|
|
13795
14147
|
cachedError = null;
|
|
13796
14148
|
_context13.prev = 5;
|
|
13797
14149
|
this._segmentProcessing = true;
|
|
13798
|
-
logger.log("load segment, sn:".concat(seg.sn, ", partIndex:").concat(seg.partIndex));
|
|
14150
|
+
logger.log("load segment, sn:".concat(seg.sn, ", [").concat(seg.start, ", ").concat(seg.end, "], partIndex:").concat(seg.partIndex));
|
|
13799
14151
|
_context13.next = 10;
|
|
13800
14152
|
return this._reqAndBufferSegment(seg, this._playlist.getAudioSegment(seg));
|
|
13801
14153
|
case 10:
|
|
@@ -13827,7 +14179,17 @@
|
|
|
13827
14179
|
return _context13.abrupt("return", this._emitError(StreamingError.create(cachedError)));
|
|
13828
14180
|
case 26:
|
|
13829
14181
|
if (appended) {
|
|
13830
|
-
|
|
14182
|
+
bufferEnd = this.bufferInfo().end;
|
|
14183
|
+
if (this.isLive && !this.media.seeking && bufferEnd && Math.abs(seg.end - bufferEnd) > 1) {
|
|
14184
|
+
logger.warn("segment: ".concat(seg.sn, " expected end=").concat(seg.end, ", real end=").concat(bufferEnd));
|
|
14185
|
+
this._playlist.feedbackLiveEdge(seg, bufferEnd);
|
|
14186
|
+
}
|
|
14187
|
+
sameStream = ((_this$_playlist$curre2 = this._playlist.currentStream) === null || _this$_playlist$curre2 === void 0 ? void 0 : _this$_playlist$curre2.url) === seg.parentUrl;
|
|
14188
|
+
if (this._urlSwitching && !sameStream) {
|
|
14189
|
+
logger.warn("pre playlist segment appended!");
|
|
14190
|
+
this._bufferService.seamlessSwitch();
|
|
14191
|
+
}
|
|
14192
|
+
if (this.isLive && this._urlSwitching && sameStream) {
|
|
13831
14193
|
this._urlSwitching = false;
|
|
13832
14194
|
this.emit(Event$1.SWITCH_URL_SUCCESS, {
|
|
13833
14195
|
url: this.config.url
|
|
@@ -13857,7 +14219,7 @@
|
|
|
13857
14219
|
value: function() {
|
|
13858
14220
|
var _reqAndBufferSegment2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee14(seg, audioSeg) {
|
|
13859
14221
|
var _this$_bufferService2;
|
|
13860
|
-
var cc, discontinuity, responses, data, sn, start, stream, before;
|
|
14222
|
+
var cc, discontinuity, responses, data, sn, start, stream, before, contiguous, segStart;
|
|
13861
14223
|
return _regeneratorRuntime$1().wrap(function _callee14$(_context14) {
|
|
13862
14224
|
while (1)
|
|
13863
14225
|
switch (_context14.prev = _context14.next) {
|
|
@@ -13900,20 +14262,27 @@
|
|
|
13900
14262
|
stream = this._playlist.currentStream;
|
|
13901
14263
|
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);
|
|
13902
14264
|
before = Date.now();
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
14265
|
+
contiguous = this._prevSegSn === sn - 1;
|
|
14266
|
+
if (this.isLive && this._urlSwitching) {
|
|
14267
|
+
segStart = this.bufferInfo().end;
|
|
14268
|
+
this._playlist.updateSegmentsRanges(sn, segStart);
|
|
14269
|
+
logger.warn("update the new playlist liveEdge, segment id=".concat(sn, ", buffer start=").concat(segStart, ", liveEdge=").concat(this._playlist.liveEdge));
|
|
14270
|
+
start = segStart;
|
|
14271
|
+
}
|
|
14272
|
+
_context14.next = 30;
|
|
14273
|
+
return this._bufferService.appendBuffer(seg, audioSeg, data[0], data[1], discontinuity, contiguous, start);
|
|
14274
|
+
case 30:
|
|
13906
14275
|
this.emit(Event$1.APPEND_COST, {
|
|
13907
14276
|
elapsed: Date.now() - before,
|
|
13908
14277
|
url: seg.url
|
|
13909
14278
|
});
|
|
13910
|
-
_context14.next =
|
|
14279
|
+
_context14.next = 33;
|
|
13911
14280
|
return this._bufferService.evictBuffer(this.config.bufferBehind);
|
|
13912
|
-
case
|
|
14281
|
+
case 33:
|
|
13913
14282
|
this._prevSegCc = cc;
|
|
13914
14283
|
this._prevSegSn = sn;
|
|
13915
14284
|
return _context14.abrupt("return", true);
|
|
13916
|
-
case
|
|
14285
|
+
case 36:
|
|
13917
14286
|
case "end":
|
|
13918
14287
|
return _context14.stop();
|
|
13919
14288
|
}
|
|
@@ -14112,6 +14481,25 @@
|
|
|
14112
14481
|
}
|
|
14113
14482
|
return nextLoadPoint;
|
|
14114
14483
|
}
|
|
14484
|
+
}, {
|
|
14485
|
+
key: "_tryEos",
|
|
14486
|
+
value: function _tryEos() {
|
|
14487
|
+
var _this$_bufferService3, _this$_bufferService4;
|
|
14488
|
+
var media = this.media;
|
|
14489
|
+
var _this$_playlist = this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
|
|
14490
|
+
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);
|
|
14491
|
+
if (!eosAllowed) {
|
|
14492
|
+
return;
|
|
14493
|
+
}
|
|
14494
|
+
var bInfo = this.bufferInfo();
|
|
14495
|
+
if (media.paused && !media.currentTime) {
|
|
14496
|
+
bInfo = this.bufferInfo(bInfo.nextStart || 0.5);
|
|
14497
|
+
}
|
|
14498
|
+
var bufferThroughout = Math.abs(bInfo.end - media.duration) < 0.1 || !this.isLive && lastSegment && bInfo.end >= lastSegment.start + lastSegment.duration;
|
|
14499
|
+
if (bufferThroughout) {
|
|
14500
|
+
this._bufferService.endOfStream();
|
|
14501
|
+
}
|
|
14502
|
+
}
|
|
14115
14503
|
}], [{
|
|
14116
14504
|
key: "isSupported",
|
|
14117
14505
|
value: function isSupported(mediaType) {
|
|
@@ -14135,7 +14523,7 @@
|
|
|
14135
14523
|
}]);
|
|
14136
14524
|
return Hls2;
|
|
14137
14525
|
}(EventEmitter);
|
|
14138
|
-
_defineProperty$3(Hls, "version", "3.0.
|
|
14526
|
+
_defineProperty$3(Hls, "version", "3.0.17");
|
|
14139
14527
|
try {
|
|
14140
14528
|
if (localStorage.getItem("xgd")) {
|
|
14141
14529
|
Hls.enableLogger();
|
|
@@ -14264,17 +14652,22 @@
|
|
|
14264
14652
|
(_this$hls2 = _this.hls) === null || _this$hls2 === void 0 ? void 0 : _this$hls2.switchSubtitleStream(lang);
|
|
14265
14653
|
});
|
|
14266
14654
|
_defineProperty$3(_assertThisInitialized$2(_this), "_onSwitchURL", function(url, args) {
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14655
|
+
return new Promise(function(resolve, reject) {
|
|
14656
|
+
var _assertThisInitialize = _assertThisInitialized$2(_this), player = _assertThisInitialize.player, hls = _assertThisInitialize.hls;
|
|
14657
|
+
if (hls) {
|
|
14658
|
+
var _this$player$config, _this$player$config$h;
|
|
14659
|
+
var options = parseSwitchUrlArgs(args, _assertThisInitialized$2(_this));
|
|
14660
|
+
player.config.url = url;
|
|
14661
|
+
hls.switchURL(url, options).then(function() {
|
|
14662
|
+
return resolve(true);
|
|
14663
|
+
}).catch(reject);
|
|
14664
|
+
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) {
|
|
14665
|
+
_this._keepPauseStatus();
|
|
14666
|
+
}
|
|
14667
|
+
} else {
|
|
14668
|
+
reject();
|
|
14276
14669
|
}
|
|
14277
|
-
}
|
|
14670
|
+
});
|
|
14278
14671
|
});
|
|
14279
14672
|
_defineProperty$3(_assertThisInitialized$2(_this), "_keepPauseStatus", function() {
|
|
14280
14673
|
var paused = _this.player.paused;
|
|
@@ -14309,13 +14702,14 @@
|
|
|
14309
14702
|
value: function beforePlayerInit() {
|
|
14310
14703
|
var _this2 = this;
|
|
14311
14704
|
var config = this.player.config;
|
|
14312
|
-
|
|
14705
|
+
var hlsOpts = config.hls || {};
|
|
14706
|
+
if (!config.url && !config.__allowHlsEmptyUrl__ || !hlsOpts.preferMMS && MSE.isMMSOnly()) {
|
|
14313
14707
|
return;
|
|
14314
14708
|
}
|
|
14315
14709
|
if (this.hls)
|
|
14316
14710
|
this.hls.destroy();
|
|
14317
14711
|
this.player.switchURL = this._onSwitchURL;
|
|
14318
|
-
|
|
14712
|
+
this.player.handleSource = false;
|
|
14319
14713
|
hlsOpts.innerDegrade = hlsOpts.innerDegrade || config.innerDegrade;
|
|
14320
14714
|
if (hlsOpts.disconnectTime === null || hlsOpts.disconnectTime === void 0)
|
|
14321
14715
|
hlsOpts.disconnectTime = 0;
|
|
@@ -14367,6 +14761,7 @@
|
|
|
14367
14761
|
this._transCoreEvent(EVENT.LOAD_COMPLETE);
|
|
14368
14762
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
14369
14763
|
this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED);
|
|
14764
|
+
this._transCoreEvent(EVENT.MEDIASOURCE_OPENED);
|
|
14370
14765
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
14371
14766
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
14372
14767
|
this._transCoreEvent(EVENT.KEYFRAME);
|