@byteplus/veplayer-plugin 2.3.1-rc.3 → 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
|
@@ -474,7 +474,7 @@
|
|
|
474
474
|
}
|
|
475
475
|
return _assertThisInitialized$3(self2);
|
|
476
476
|
}
|
|
477
|
-
function _createSuper$
|
|
477
|
+
function _createSuper$2(Derived) {
|
|
478
478
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
479
479
|
return function _createSuperInternal() {
|
|
480
480
|
var Super = _getPrototypeOf$3(Derived), result;
|
|
@@ -1391,6 +1391,9 @@
|
|
|
1391
1391
|
_fun && _fun(frameId);
|
|
1392
1392
|
};
|
|
1393
1393
|
util.isMSE = function(video) {
|
|
1394
|
+
if (video.media) {
|
|
1395
|
+
video = video.media;
|
|
1396
|
+
}
|
|
1394
1397
|
if (!video || !(video instanceof HTMLMediaElement)) {
|
|
1395
1398
|
return false;
|
|
1396
1399
|
}
|
|
@@ -1539,7 +1542,7 @@
|
|
|
1539
1542
|
}
|
|
1540
1543
|
return offsetTime;
|
|
1541
1544
|
};
|
|
1542
|
-
var version = "3.0.
|
|
1545
|
+
var version = "3.0.17";
|
|
1543
1546
|
var ERROR_MAP = {
|
|
1544
1547
|
1: 5101,
|
|
1545
1548
|
2: 5102,
|
|
@@ -2514,7 +2517,7 @@
|
|
|
2514
2517
|
}
|
|
2515
2518
|
return _assertThisInitialized$2(self2);
|
|
2516
2519
|
}
|
|
2517
|
-
function _createSuper$
|
|
2520
|
+
function _createSuper$1(Derived) {
|
|
2518
2521
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
2519
2522
|
return function _createSuperInternal() {
|
|
2520
2523
|
var Super = _getPrototypeOf$2(Derived), result;
|
|
@@ -2642,30 +2645,6 @@
|
|
|
2642
2645
|
var key = _toPrimitive$2(arg, "string");
|
|
2643
2646
|
return typeof key === "symbol" ? key : String(key);
|
|
2644
2647
|
}
|
|
2645
|
-
function createPublicPromise() {
|
|
2646
|
-
var res, rej;
|
|
2647
|
-
var promise = new Promise(function(resolve, reject) {
|
|
2648
|
-
res = resolve;
|
|
2649
|
-
rej = reject;
|
|
2650
|
-
});
|
|
2651
|
-
promise.used = false;
|
|
2652
|
-
promise.resolve = function() {
|
|
2653
|
-
promise.used = true;
|
|
2654
|
-
return res.apply(void 0, arguments);
|
|
2655
|
-
};
|
|
2656
|
-
promise.reject = function() {
|
|
2657
|
-
promise.used = true;
|
|
2658
|
-
return rej.apply(void 0, arguments);
|
|
2659
|
-
};
|
|
2660
|
-
return promise;
|
|
2661
|
-
}
|
|
2662
|
-
function nowTime$1() {
|
|
2663
|
-
try {
|
|
2664
|
-
return parseInt(performance.now(), 10);
|
|
2665
|
-
} catch (e) {
|
|
2666
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
2648
|
var Buffer$1 = /* @__PURE__ */ function() {
|
|
2670
2649
|
function Buffer2() {
|
|
2671
2650
|
_classCallCheck$2(this, Buffer2);
|
|
@@ -2787,6 +2766,7 @@
|
|
|
2787
2766
|
}]);
|
|
2788
2767
|
return Buffer2;
|
|
2789
2768
|
}();
|
|
2769
|
+
var isBrowser$1 = typeof window !== "undefined";
|
|
2790
2770
|
var _ERR_CODE;
|
|
2791
2771
|
var ERR = {
|
|
2792
2772
|
MANIFEST: "manifest",
|
|
@@ -2863,7 +2843,7 @@
|
|
|
2863
2843
|
}), _ERR_CODE);
|
|
2864
2844
|
var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
2865
2845
|
_inherits$2(StreamingError2, _Error);
|
|
2866
|
-
var _super = _createSuper$
|
|
2846
|
+
var _super = _createSuper$1(StreamingError2);
|
|
2867
2847
|
function StreamingError2(type, subType, origin, payload, msg) {
|
|
2868
2848
|
var _this;
|
|
2869
2849
|
_classCallCheck$2(this, StreamingError2);
|
|
@@ -2905,7 +2885,6 @@
|
|
|
2905
2885
|
}]);
|
|
2906
2886
|
return StreamingError2;
|
|
2907
2887
|
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
2908
|
-
var isBrowser$1 = typeof window !== "undefined";
|
|
2909
2888
|
var LogCacheLevel = {
|
|
2910
2889
|
"DEBUG": 1,
|
|
2911
2890
|
"LOG": 2,
|
|
@@ -2934,7 +2913,7 @@
|
|
|
2934
2913
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
2935
2914
|
if (Logger2.disabled)
|
|
2936
2915
|
return;
|
|
2937
|
-
(_console = console).debug.apply(_console, [this._prefix, nowTime()].concat(args));
|
|
2916
|
+
(_console = console).debug.apply(_console, [this._prefix, nowTime$1()].concat(args));
|
|
2938
2917
|
}
|
|
2939
2918
|
}, {
|
|
2940
2919
|
key: "log",
|
|
@@ -2946,7 +2925,7 @@
|
|
|
2946
2925
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
2947
2926
|
if (Logger2.disabled)
|
|
2948
2927
|
return;
|
|
2949
|
-
(_console2 = console).log.apply(_console2, [this._prefix, nowTime()].concat(args));
|
|
2928
|
+
(_console2 = console).log.apply(_console2, [this._prefix, nowTime$1()].concat(args));
|
|
2950
2929
|
}
|
|
2951
2930
|
}, {
|
|
2952
2931
|
key: "warn",
|
|
@@ -2958,7 +2937,7 @@
|
|
|
2958
2937
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
2959
2938
|
if (Logger2.disabled)
|
|
2960
2939
|
return;
|
|
2961
|
-
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime()].concat(args));
|
|
2940
|
+
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime$1()].concat(args));
|
|
2962
2941
|
}
|
|
2963
2942
|
}, {
|
|
2964
2943
|
key: "error",
|
|
@@ -2970,7 +2949,7 @@
|
|
|
2970
2949
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
2971
2950
|
if (Logger2.disabled)
|
|
2972
2951
|
return;
|
|
2973
|
-
(_console4 = console).error.apply(_console4, [this._prefix, nowTime()].concat(args));
|
|
2952
|
+
(_console4 = console).error.apply(_console4, [this._prefix, nowTime$1()].concat(args));
|
|
2974
2953
|
}
|
|
2975
2954
|
}, {
|
|
2976
2955
|
key: "logCache",
|
|
@@ -2985,7 +2964,7 @@
|
|
|
2985
2964
|
var finLogText = logText.map(function(item) {
|
|
2986
2965
|
return logable(item);
|
|
2987
2966
|
});
|
|
2988
|
-
text = this._prefix + nowTime() + JSON.stringify(finLogText);
|
|
2967
|
+
text = this._prefix + nowTime$1() + JSON.stringify(finLogText);
|
|
2989
2968
|
} catch (e) {
|
|
2990
2969
|
return;
|
|
2991
2970
|
}
|
|
@@ -3040,7 +3019,7 @@
|
|
|
3040
3019
|
return Logger2;
|
|
3041
3020
|
}();
|
|
3042
3021
|
_defineProperty$1(Logger$2, "disabled", true);
|
|
3043
|
-
function nowTime() {
|
|
3022
|
+
function nowTime$1() {
|
|
3044
3023
|
return (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3045
3024
|
}
|
|
3046
3025
|
function reduceDepth(val) {
|
|
@@ -3088,6 +3067,46 @@
|
|
|
3088
3067
|
}
|
|
3089
3068
|
return result;
|
|
3090
3069
|
}
|
|
3070
|
+
function createPublicPromise() {
|
|
3071
|
+
var res, rej;
|
|
3072
|
+
var promise = new Promise(function(resolve, reject) {
|
|
3073
|
+
res = resolve;
|
|
3074
|
+
rej = reject;
|
|
3075
|
+
});
|
|
3076
|
+
promise.used = false;
|
|
3077
|
+
promise.resolve = function() {
|
|
3078
|
+
promise.used = true;
|
|
3079
|
+
return res.apply(void 0, arguments);
|
|
3080
|
+
};
|
|
3081
|
+
promise.reject = function() {
|
|
3082
|
+
promise.used = true;
|
|
3083
|
+
return rej.apply(void 0, arguments);
|
|
3084
|
+
};
|
|
3085
|
+
return promise;
|
|
3086
|
+
}
|
|
3087
|
+
function nowTime() {
|
|
3088
|
+
try {
|
|
3089
|
+
return parseInt(performance.now(), 10);
|
|
3090
|
+
} catch (e) {
|
|
3091
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
var SafeJSON = {
|
|
3095
|
+
stringify: function stringify(obj) {
|
|
3096
|
+
try {
|
|
3097
|
+
return JSON.stringify(obj);
|
|
3098
|
+
} catch (e) {
|
|
3099
|
+
return "";
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
parse: function parse2(obj) {
|
|
3103
|
+
try {
|
|
3104
|
+
return JSON.parse(obj);
|
|
3105
|
+
} catch (e) {
|
|
3106
|
+
return void 0;
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
};
|
|
3091
3110
|
function getMediaSource() {
|
|
3092
3111
|
var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3093
3112
|
try {
|
|
@@ -3102,6 +3121,18 @@
|
|
|
3102
3121
|
function isMMS(mediaSource) {
|
|
3103
3122
|
return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
|
|
3104
3123
|
}
|
|
3124
|
+
function getTimeRanges(buffered) {
|
|
3125
|
+
var ranges = [];
|
|
3126
|
+
if (buffered instanceof TimeRanges) {
|
|
3127
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
3128
|
+
ranges.push({
|
|
3129
|
+
start: buffered.start(i),
|
|
3130
|
+
end: buffered.end(i)
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
return ranges;
|
|
3135
|
+
}
|
|
3105
3136
|
var OP_NAME = {
|
|
3106
3137
|
APPEND: "appendBuffer",
|
|
3107
3138
|
REMOVE: "removeBuffer",
|
|
@@ -3136,8 +3167,9 @@
|
|
|
3136
3167
|
queue.shift();
|
|
3137
3168
|
}
|
|
3138
3169
|
if (op) {
|
|
3139
|
-
var
|
|
3140
|
-
|
|
3170
|
+
var _this2$_sourceBuffer$;
|
|
3171
|
+
var costtime = nowTime() - _this2._opst;
|
|
3172
|
+
_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);
|
|
3141
3173
|
op.promise.resolve({
|
|
3142
3174
|
name: op.opName,
|
|
3143
3175
|
context: op.context,
|
|
@@ -3171,6 +3203,19 @@
|
|
|
3171
3203
|
var _this$mediaSource;
|
|
3172
3204
|
return ((_this$mediaSource = this.mediaSource) === null || _this$mediaSource === void 0 ? void 0 : _this$mediaSource.readyState) === "open";
|
|
3173
3205
|
}
|
|
3206
|
+
}, {
|
|
3207
|
+
key: "hasOpTasks",
|
|
3208
|
+
get: function get() {
|
|
3209
|
+
var _this3 = this;
|
|
3210
|
+
var flag = false;
|
|
3211
|
+
Object.keys(this._queue).forEach(function(k) {
|
|
3212
|
+
var queue = _this3._queue[k];
|
|
3213
|
+
if (Array.isArray(queue)) {
|
|
3214
|
+
flag || (flag = queue.length > 0);
|
|
3215
|
+
}
|
|
3216
|
+
});
|
|
3217
|
+
return flag;
|
|
3218
|
+
}
|
|
3174
3219
|
}, {
|
|
3175
3220
|
key: "url",
|
|
3176
3221
|
get: function get() {
|
|
@@ -3200,13 +3245,13 @@
|
|
|
3200
3245
|
}, {
|
|
3201
3246
|
key: "updateDuration",
|
|
3202
3247
|
value: function updateDuration(duration) {
|
|
3203
|
-
var
|
|
3248
|
+
var _this4 = this;
|
|
3204
3249
|
var isReduceDuration = this.mediaSource && this.mediaSource.duration > duration;
|
|
3205
3250
|
if (this.mediaSource && this.mediaSource.duration > duration) {
|
|
3206
3251
|
var bufferEnd = 0;
|
|
3207
3252
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3208
3253
|
try {
|
|
3209
|
-
bufferEnd = Math.max(
|
|
3254
|
+
bufferEnd = Math.max(_this4.bufferEnd(k) || 0, bufferEnd);
|
|
3210
3255
|
} catch (error) {
|
|
3211
3256
|
}
|
|
3212
3257
|
});
|
|
@@ -3215,13 +3260,13 @@
|
|
|
3215
3260
|
}
|
|
3216
3261
|
}
|
|
3217
3262
|
return this._enqueueBlockingOp(function() {
|
|
3218
|
-
if (
|
|
3219
|
-
|
|
3263
|
+
if (_this4.isEnded) {
|
|
3264
|
+
_this4._logger.debug("setDuration but ended");
|
|
3220
3265
|
return;
|
|
3221
3266
|
}
|
|
3222
|
-
if (
|
|
3223
|
-
|
|
3224
|
-
|
|
3267
|
+
if (_this4.mediaSource) {
|
|
3268
|
+
_this4.mediaSource.duration = duration;
|
|
3269
|
+
_this4._logger.debug("setDuration", duration);
|
|
3225
3270
|
}
|
|
3226
3271
|
}, OP_NAME.UPDATE_DURATION, {
|
|
3227
3272
|
isReduceDuration
|
|
@@ -3230,14 +3275,14 @@
|
|
|
3230
3275
|
}, {
|
|
3231
3276
|
key: "open",
|
|
3232
3277
|
value: function open() {
|
|
3233
|
-
var
|
|
3278
|
+
var _this5 = this;
|
|
3234
3279
|
if (this._openPromise.used && !this.isOpened && this.mediaSource) {
|
|
3235
3280
|
var ms = this.mediaSource;
|
|
3236
3281
|
var onOpen = function onOpen2() {
|
|
3237
|
-
var costTime = nowTime
|
|
3238
|
-
|
|
3282
|
+
var costTime = nowTime() - _this5._st;
|
|
3283
|
+
_this5._logger.debug("sourceopen", costTime);
|
|
3239
3284
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3240
|
-
|
|
3285
|
+
_this5._openPromise.resolve({
|
|
3241
3286
|
costtime: costTime
|
|
3242
3287
|
});
|
|
3243
3288
|
};
|
|
@@ -3250,8 +3295,8 @@
|
|
|
3250
3295
|
key: "bindMedia",
|
|
3251
3296
|
value: function() {
|
|
3252
3297
|
var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
|
|
3253
|
-
var
|
|
3254
|
-
var
|
|
3298
|
+
var _this6 = this;
|
|
3299
|
+
var MediaSource2, ms, useMMS, onOpen;
|
|
3255
3300
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3256
3301
|
while (1)
|
|
3257
3302
|
switch (_context.prev = _context.next) {
|
|
@@ -3263,23 +3308,23 @@
|
|
|
3263
3308
|
_context.next = 3;
|
|
3264
3309
|
return this.unbindMedia();
|
|
3265
3310
|
case 3:
|
|
3266
|
-
|
|
3267
|
-
if (!(!media || !
|
|
3311
|
+
MediaSource2 = getMediaSource(this._config.preferMMS);
|
|
3312
|
+
if (!(!media || !MediaSource2)) {
|
|
3268
3313
|
_context.next = 6;
|
|
3269
3314
|
break;
|
|
3270
3315
|
}
|
|
3271
3316
|
throw new Error("Param media or MediaSource does not exist");
|
|
3272
3317
|
case 6:
|
|
3273
3318
|
this.media = media;
|
|
3274
|
-
ms = this.mediaSource = new
|
|
3319
|
+
ms = this.mediaSource = new MediaSource2();
|
|
3275
3320
|
useMMS = isMMS(ms);
|
|
3276
|
-
this._st = nowTime
|
|
3321
|
+
this._st = nowTime();
|
|
3277
3322
|
onOpen = function onOpen2() {
|
|
3278
|
-
var costTime = nowTime
|
|
3279
|
-
|
|
3323
|
+
var costTime = nowTime() - _this6._st;
|
|
3324
|
+
_this6._logger.debug("sourceopen");
|
|
3280
3325
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3281
3326
|
URL.revokeObjectURL(media.src);
|
|
3282
|
-
|
|
3327
|
+
_this6._openPromise.resolve({
|
|
3283
3328
|
costtime: costTime
|
|
3284
3329
|
});
|
|
3285
3330
|
};
|
|
@@ -3307,7 +3352,7 @@
|
|
|
3307
3352
|
key: "unbindMedia",
|
|
3308
3353
|
value: function() {
|
|
3309
3354
|
var _unbindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
|
|
3310
|
-
var
|
|
3355
|
+
var _this7 = this;
|
|
3311
3356
|
var ms, hasMetadata, mseOpen;
|
|
3312
3357
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3313
3358
|
while (1)
|
|
@@ -3318,7 +3363,7 @@
|
|
|
3318
3363
|
ms = this.mediaSource;
|
|
3319
3364
|
if (ms) {
|
|
3320
3365
|
Object.keys(this._queue).forEach(function(t) {
|
|
3321
|
-
var queue =
|
|
3366
|
+
var queue = _this7._queue[t];
|
|
3322
3367
|
if (queue) {
|
|
3323
3368
|
queue.forEach(function(x) {
|
|
3324
3369
|
var _x$promise, _x$promise$resolve;
|
|
@@ -3336,7 +3381,7 @@
|
|
|
3336
3381
|
}
|
|
3337
3382
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3338
3383
|
try {
|
|
3339
|
-
ms.removeSourceBuffer(
|
|
3384
|
+
ms.removeSourceBuffer(_this7._sourceBuffer[k]);
|
|
3340
3385
|
} catch (error) {
|
|
3341
3386
|
}
|
|
3342
3387
|
});
|
|
@@ -3387,7 +3432,7 @@
|
|
|
3387
3432
|
}, {
|
|
3388
3433
|
key: "changeType",
|
|
3389
3434
|
value: function changeType(type, mimeType) {
|
|
3390
|
-
var
|
|
3435
|
+
var _this8 = this;
|
|
3391
3436
|
var sb = this._sourceBuffer[type];
|
|
3392
3437
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3393
3438
|
return Promise.resolve();
|
|
@@ -3396,7 +3441,7 @@
|
|
|
3396
3441
|
return this._enqueueOp(type, function() {
|
|
3397
3442
|
sb.changeType(mimeType);
|
|
3398
3443
|
sb.mimeType = mimeType;
|
|
3399
|
-
|
|
3444
|
+
_this8._onSBUpdateEnd(type);
|
|
3400
3445
|
}, "changeType", {
|
|
3401
3446
|
mimeType
|
|
3402
3447
|
});
|
|
@@ -3410,60 +3455,60 @@
|
|
|
3410
3455
|
}, {
|
|
3411
3456
|
key: "append",
|
|
3412
3457
|
value: function append(type, buffer, context) {
|
|
3413
|
-
var
|
|
3458
|
+
var _this9 = this;
|
|
3414
3459
|
if (!buffer || !buffer.byteLength) {
|
|
3415
3460
|
return Promise.resolve();
|
|
3416
3461
|
}
|
|
3417
3462
|
if (!this._sourceBuffer[type])
|
|
3418
3463
|
return Promise.resolve();
|
|
3419
3464
|
return this._enqueueOp(type, function() {
|
|
3420
|
-
var
|
|
3421
|
-
if (!
|
|
3465
|
+
var _this9$_sourceBuffer$;
|
|
3466
|
+
if (!_this9.mediaSource || _this9.media.error)
|
|
3422
3467
|
return;
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
(
|
|
3468
|
+
_this9._logger.debug("MSE APPEND START", context);
|
|
3469
|
+
_this9._opst = nowTime();
|
|
3470
|
+
(_this9$_sourceBuffer$ = _this9._sourceBuffer[type]) === null || _this9$_sourceBuffer$ === void 0 ? void 0 : _this9$_sourceBuffer$.appendBuffer(buffer);
|
|
3426
3471
|
}, OP_NAME.APPEND, context);
|
|
3427
3472
|
}
|
|
3428
3473
|
}, {
|
|
3429
3474
|
key: "remove",
|
|
3430
3475
|
value: function remove(type, startTime, endTime, context) {
|
|
3431
|
-
var
|
|
3476
|
+
var _this10 = this;
|
|
3432
3477
|
var isInsertHead = false;
|
|
3433
3478
|
if (this._mseFullFlag[type]) {
|
|
3434
3479
|
isInsertHead = true;
|
|
3435
3480
|
}
|
|
3436
3481
|
return this._enqueueOp(type, function() {
|
|
3437
|
-
if (!
|
|
3482
|
+
if (!_this10.mediaSource || _this10.media.error)
|
|
3438
3483
|
return;
|
|
3439
|
-
var sb =
|
|
3484
|
+
var sb = _this10._sourceBuffer[type];
|
|
3440
3485
|
if (startTime >= endTime || !sb) {
|
|
3441
|
-
|
|
3486
|
+
_this10._onSBUpdateEnd(type);
|
|
3442
3487
|
return;
|
|
3443
3488
|
}
|
|
3444
|
-
|
|
3445
|
-
|
|
3489
|
+
_this10._opst = nowTime();
|
|
3490
|
+
_this10._logger.debug("MSE REMOVE START", type, startTime, endTime, context);
|
|
3446
3491
|
sb.remove(startTime, endTime);
|
|
3447
3492
|
}, OP_NAME.REMOVE, context, isInsertHead);
|
|
3448
3493
|
}
|
|
3449
3494
|
}, {
|
|
3450
3495
|
key: "clearBuffer",
|
|
3451
3496
|
value: function clearBuffer(startTime, endTime) {
|
|
3452
|
-
var
|
|
3497
|
+
var _this11 = this;
|
|
3453
3498
|
var p;
|
|
3454
3499
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3455
|
-
p =
|
|
3500
|
+
p = _this11.remove(k, startTime, endTime);
|
|
3456
3501
|
});
|
|
3457
3502
|
return p || Promise.resolve();
|
|
3458
3503
|
}
|
|
3459
3504
|
}, {
|
|
3460
3505
|
key: "clearAllBuffer",
|
|
3461
3506
|
value: function clearAllBuffer() {
|
|
3462
|
-
var
|
|
3507
|
+
var _this12 = this;
|
|
3463
3508
|
var p;
|
|
3464
3509
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3465
|
-
var sb =
|
|
3466
|
-
p =
|
|
3510
|
+
var sb = _this12._sourceBuffer[k];
|
|
3511
|
+
p = _this12.remove(k, 0, Buffer$1.end(Buffer$1.get(sb)));
|
|
3467
3512
|
});
|
|
3468
3513
|
return p;
|
|
3469
3514
|
}
|
|
@@ -3491,14 +3536,14 @@
|
|
|
3491
3536
|
}, {
|
|
3492
3537
|
key: "endOfStream",
|
|
3493
3538
|
value: function endOfStream(reason) {
|
|
3494
|
-
var
|
|
3539
|
+
var _this13 = this;
|
|
3495
3540
|
if (!this.mediaSource || this.mediaSource.readyState !== "open")
|
|
3496
3541
|
return Promise.resolve();
|
|
3497
3542
|
return this._enqueueBlockingOp(function() {
|
|
3498
|
-
var ms =
|
|
3543
|
+
var ms = _this13.mediaSource;
|
|
3499
3544
|
if (!ms || ms.readyState !== "open")
|
|
3500
3545
|
return;
|
|
3501
|
-
|
|
3546
|
+
_this13._logger.debug("MSE endOfStream START");
|
|
3502
3547
|
if (reason) {
|
|
3503
3548
|
ms.endOfStream(reason);
|
|
3504
3549
|
} else {
|
|
@@ -3537,7 +3582,7 @@
|
|
|
3537
3582
|
}, {
|
|
3538
3583
|
key: "_enqueueOp",
|
|
3539
3584
|
value: function _enqueueOp(type, exec, opName, context, isInsertHead) {
|
|
3540
|
-
var
|
|
3585
|
+
var _this14 = this;
|
|
3541
3586
|
if (!this.mediaSource)
|
|
3542
3587
|
return Promise.resolve();
|
|
3543
3588
|
var queue = this._queue[type] = this._queue[type] || [];
|
|
@@ -3561,7 +3606,7 @@
|
|
|
3561
3606
|
} else {
|
|
3562
3607
|
this._openPromise.then(function() {
|
|
3563
3608
|
if (queue.length === 1) {
|
|
3564
|
-
|
|
3609
|
+
_this14._startQueue(type);
|
|
3565
3610
|
}
|
|
3566
3611
|
});
|
|
3567
3612
|
}
|
|
@@ -3571,7 +3616,7 @@
|
|
|
3571
3616
|
key: "_enqueueBlockingOp",
|
|
3572
3617
|
value: function() {
|
|
3573
3618
|
var _enqueueBlockingOp2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(exec, opName, context) {
|
|
3574
|
-
var
|
|
3619
|
+
var _this15 = this;
|
|
3575
3620
|
var types, waiters;
|
|
3576
3621
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3577
3622
|
while (1)
|
|
@@ -3592,7 +3637,7 @@
|
|
|
3592
3637
|
case 5:
|
|
3593
3638
|
waiters = [];
|
|
3594
3639
|
types.forEach(function(t) {
|
|
3595
|
-
var queue =
|
|
3640
|
+
var queue = _this15._queue[t];
|
|
3596
3641
|
var prom = createPublicPromise();
|
|
3597
3642
|
waiters.push(prom);
|
|
3598
3643
|
queue.push({
|
|
@@ -3604,7 +3649,7 @@
|
|
|
3604
3649
|
context
|
|
3605
3650
|
});
|
|
3606
3651
|
if (queue.length === 1) {
|
|
3607
|
-
|
|
3652
|
+
_this15._startQueue(t);
|
|
3608
3653
|
}
|
|
3609
3654
|
});
|
|
3610
3655
|
return _context3.abrupt("return", Promise.all(waiters).then(function() {
|
|
@@ -3612,11 +3657,11 @@
|
|
|
3612
3657
|
return exec();
|
|
3613
3658
|
} finally {
|
|
3614
3659
|
types.forEach(function(t) {
|
|
3615
|
-
var queue =
|
|
3616
|
-
var sb =
|
|
3660
|
+
var queue = _this15._queue[t];
|
|
3661
|
+
var sb = _this15._sourceBuffer[t];
|
|
3617
3662
|
queue === null || queue === void 0 ? void 0 : queue.shift();
|
|
3618
3663
|
if (!sb || !sb.updating) {
|
|
3619
|
-
|
|
3664
|
+
_this15._startQueue(t);
|
|
3620
3665
|
}
|
|
3621
3666
|
});
|
|
3622
3667
|
}
|
|
@@ -3659,41 +3704,46 @@
|
|
|
3659
3704
|
}, {
|
|
3660
3705
|
key: "setTimeoffset",
|
|
3661
3706
|
value: function setTimeoffset(type, timestampOffset, context) {
|
|
3662
|
-
var
|
|
3707
|
+
var _this16 = this;
|
|
3663
3708
|
return this._enqueueOp(type, function() {
|
|
3664
3709
|
if (timestampOffset < 0) {
|
|
3665
3710
|
timestampOffset += 1e-3;
|
|
3666
3711
|
}
|
|
3667
|
-
|
|
3668
|
-
|
|
3712
|
+
_this16._sourceBuffer[type].timestampOffset = timestampOffset;
|
|
3713
|
+
_this16._onSBUpdateEnd(type);
|
|
3669
3714
|
}, "setTimeoffset", context);
|
|
3670
3715
|
}
|
|
3671
3716
|
}, {
|
|
3672
3717
|
key: "abort",
|
|
3673
3718
|
value: function abort(type, context) {
|
|
3674
|
-
var
|
|
3719
|
+
var _this17 = this;
|
|
3675
3720
|
if (!this.isOpened) {
|
|
3676
3721
|
return Promise.resolve();
|
|
3677
3722
|
}
|
|
3678
3723
|
return this._enqueueOp(type, function() {
|
|
3679
|
-
|
|
3680
|
-
|
|
3724
|
+
_this17._sourceBuffer[type].abort();
|
|
3725
|
+
_this17._onSBUpdateEnd(type);
|
|
3681
3726
|
}, "abort", context);
|
|
3682
3727
|
}
|
|
3683
3728
|
}], [{
|
|
3684
3729
|
key: "isSupported",
|
|
3685
3730
|
value: function isSupported() {
|
|
3686
3731
|
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3687
|
-
var
|
|
3688
|
-
if (!
|
|
3732
|
+
var MediaSource2 = getMediaSource();
|
|
3733
|
+
if (!MediaSource2)
|
|
3689
3734
|
return false;
|
|
3690
3735
|
try {
|
|
3691
|
-
return
|
|
3736
|
+
return MediaSource2.isTypeSupported(mime);
|
|
3692
3737
|
} catch (error) {
|
|
3693
3738
|
this._logger.error(mime, error);
|
|
3694
3739
|
return false;
|
|
3695
3740
|
}
|
|
3696
3741
|
}
|
|
3742
|
+
}, {
|
|
3743
|
+
key: "isMMSOnly",
|
|
3744
|
+
value: function isMMSOnly() {
|
|
3745
|
+
return typeof ManagedMediaSource !== "undefined" && typeof MediaSource === "undefined";
|
|
3746
|
+
}
|
|
3697
3747
|
}, {
|
|
3698
3748
|
key: "getDefaultConfig",
|
|
3699
3749
|
value: function getDefaultConfig() {
|
|
@@ -3718,7 +3768,7 @@
|
|
|
3718
3768
|
};
|
|
3719
3769
|
var NetError = /* @__PURE__ */ function(_Error) {
|
|
3720
3770
|
_inherits$2(NetError2, _Error);
|
|
3721
|
-
var _super = _createSuper$
|
|
3771
|
+
var _super = _createSuper$1(NetError2);
|
|
3722
3772
|
function NetError2(url, request, response, msg) {
|
|
3723
3773
|
var _this;
|
|
3724
3774
|
_classCallCheck$2(this, NetError2);
|
|
@@ -3829,10 +3879,12 @@
|
|
|
3829
3879
|
LOAD_COMPLETE: "core.loadcomplete",
|
|
3830
3880
|
LOAD_RETRY: "core.loadretry",
|
|
3831
3881
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3882
|
+
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3832
3883
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3833
3884
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3834
3885
|
BUFFEREOS: "core.buffereos",
|
|
3835
3886
|
KEYFRAME: "core.keyframe",
|
|
3887
|
+
CHASEFRAME: "core.chaseframe",
|
|
3836
3888
|
METADATA_PARSED: "core.metadataparsed",
|
|
3837
3889
|
SEI: "core.sei",
|
|
3838
3890
|
SEI_IN_TIME: "core.seiintime",
|
|
@@ -3856,7 +3908,7 @@
|
|
|
3856
3908
|
var CACHESIZE = 2 * 1024 * 1024;
|
|
3857
3909
|
var FetchLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
3858
3910
|
_inherits$2(FetchLoader2, _EventEmitter);
|
|
3859
|
-
var _super = _createSuper$
|
|
3911
|
+
var _super = _createSuper$1(FetchLoader2);
|
|
3860
3912
|
function FetchLoader2() {
|
|
3861
3913
|
var _this;
|
|
3862
3914
|
_classCallCheck$2(this, FetchLoader2);
|
|
@@ -4308,7 +4360,7 @@
|
|
|
4308
4360
|
}
|
|
4309
4361
|
var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4310
4362
|
_inherits$2(XhrLoader2, _EventEmitter);
|
|
4311
|
-
var _super = _createSuper$
|
|
4363
|
+
var _super = _createSuper$1(XhrLoader2);
|
|
4312
4364
|
function XhrLoader2() {
|
|
4313
4365
|
var _this;
|
|
4314
4366
|
_classCallCheck$2(this, XhrLoader2);
|
|
@@ -4792,7 +4844,7 @@
|
|
|
4792
4844
|
}
|
|
4793
4845
|
var NetLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4794
4846
|
_inherits$2(NetLoader2, _EventEmitter);
|
|
4795
|
-
var _super = _createSuper$
|
|
4847
|
+
var _super = _createSuper$1(NetLoader2);
|
|
4796
4848
|
function NetLoader2(cfg) {
|
|
4797
4849
|
var _this;
|
|
4798
4850
|
_classCallCheck$2(this, NetLoader2);
|
|
@@ -5335,7 +5387,7 @@
|
|
|
5335
5387
|
}
|
|
5336
5388
|
return _assertThisInitialized$1(self2);
|
|
5337
5389
|
}
|
|
5338
|
-
function _createSuper
|
|
5390
|
+
function _createSuper(Derived) {
|
|
5339
5391
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
5340
5392
|
return function _createSuperInternal() {
|
|
5341
5393
|
var Super = _getPrototypeOf$1(Derived), result;
|
|
@@ -5479,6 +5531,26 @@
|
|
|
5479
5531
|
this.warnings = [];
|
|
5480
5532
|
this.hvcC = null;
|
|
5481
5533
|
}
|
|
5534
|
+
}, {
|
|
5535
|
+
key: "firstDts",
|
|
5536
|
+
get: function get() {
|
|
5537
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5538
|
+
}
|
|
5539
|
+
}, {
|
|
5540
|
+
key: "firstPts",
|
|
5541
|
+
get: function get() {
|
|
5542
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5543
|
+
}
|
|
5544
|
+
}, {
|
|
5545
|
+
key: "samplesDuration",
|
|
5546
|
+
get: function get() {
|
|
5547
|
+
if (this.samples.length > 0) {
|
|
5548
|
+
var first = this.samples[0];
|
|
5549
|
+
var last = this.samples[this.samples.length - 1];
|
|
5550
|
+
return last.dts - first.dts + last.duration;
|
|
5551
|
+
}
|
|
5552
|
+
return 0;
|
|
5553
|
+
}
|
|
5482
5554
|
}, {
|
|
5483
5555
|
key: "exist",
|
|
5484
5556
|
value: function exist() {
|
|
@@ -5557,6 +5629,26 @@
|
|
|
5557
5629
|
get: function get() {
|
|
5558
5630
|
return this.isAudioEncryption;
|
|
5559
5631
|
}
|
|
5632
|
+
}, {
|
|
5633
|
+
key: "firstDts",
|
|
5634
|
+
get: function get() {
|
|
5635
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5636
|
+
}
|
|
5637
|
+
}, {
|
|
5638
|
+
key: "firstPts",
|
|
5639
|
+
get: function get() {
|
|
5640
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5641
|
+
}
|
|
5642
|
+
}, {
|
|
5643
|
+
key: "samplesDuration",
|
|
5644
|
+
get: function get() {
|
|
5645
|
+
if (this.samples.length > 0) {
|
|
5646
|
+
var first = this.samples[0];
|
|
5647
|
+
var last = this.samples[this.samples.length - 1];
|
|
5648
|
+
return last.dts - first.dts + last.duration;
|
|
5649
|
+
}
|
|
5650
|
+
return 0;
|
|
5651
|
+
}
|
|
5560
5652
|
}]);
|
|
5561
5653
|
return AudioTrack2;
|
|
5562
5654
|
}();
|
|
@@ -5617,7 +5709,7 @@
|
|
|
5617
5709
|
);
|
|
5618
5710
|
var FlvScriptSample = /* @__PURE__ */ function(_Sample) {
|
|
5619
5711
|
_inherits$1(FlvScriptSample2, _Sample);
|
|
5620
|
-
var _super = _createSuper
|
|
5712
|
+
var _super = _createSuper(FlvScriptSample2);
|
|
5621
5713
|
function FlvScriptSample2() {
|
|
5622
5714
|
_classCallCheck$1(this, FlvScriptSample2);
|
|
5623
5715
|
return _super.apply(this, arguments);
|
|
@@ -5626,7 +5718,7 @@
|
|
|
5626
5718
|
}(Sample);
|
|
5627
5719
|
var SeiSample = /* @__PURE__ */ function(_Sample2) {
|
|
5628
5720
|
_inherits$1(SeiSample2, _Sample2);
|
|
5629
|
-
var _super2 = _createSuper
|
|
5721
|
+
var _super2 = _createSuper(SeiSample2);
|
|
5630
5722
|
function SeiSample2() {
|
|
5631
5723
|
_classCallCheck$1(this, SeiSample2);
|
|
5632
5724
|
return _super2.apply(this, arguments);
|
|
@@ -9424,7 +9516,8 @@
|
|
|
9424
9516
|
}();
|
|
9425
9517
|
var logger$1 = new Logger$2("BufferService");
|
|
9426
9518
|
var BufferService = /* @__PURE__ */ function() {
|
|
9427
|
-
function BufferService2(flv, softVideo
|
|
9519
|
+
function BufferService2(flv, softVideo) {
|
|
9520
|
+
var opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
9428
9521
|
_classCallCheck$4(this, BufferService2);
|
|
9429
9522
|
_defineProperty$3(this, "flv", null);
|
|
9430
9523
|
_defineProperty$3(this, "_demuxer", new FlvDemuxer());
|
|
@@ -9702,7 +9795,7 @@
|
|
|
9702
9795
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9703
9796
|
}
|
|
9704
9797
|
if (!mse) {
|
|
9705
|
-
_context5.next =
|
|
9798
|
+
_context5.next = 66;
|
|
9706
9799
|
break;
|
|
9707
9800
|
}
|
|
9708
9801
|
if (this._sourceCreated) {
|
|
@@ -9724,20 +9817,24 @@
|
|
|
9724
9817
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9725
9818
|
case 47:
|
|
9726
9819
|
_context5.prev = 47;
|
|
9820
|
+
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
9821
|
+
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
9822
|
+
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
9823
|
+
}
|
|
9727
9824
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9728
|
-
_context5.next =
|
|
9825
|
+
_context5.next = 55;
|
|
9729
9826
|
break;
|
|
9730
|
-
case
|
|
9731
|
-
_context5.prev =
|
|
9827
|
+
case 52:
|
|
9828
|
+
_context5.prev = 52;
|
|
9732
9829
|
_context5.t1 = _context5["catch"](47);
|
|
9733
9830
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9734
|
-
case
|
|
9831
|
+
case 55:
|
|
9735
9832
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9736
|
-
_context5.next =
|
|
9833
|
+
_context5.next = 57;
|
|
9737
9834
|
break;
|
|
9738
9835
|
}
|
|
9739
9836
|
return _context5.abrupt("return");
|
|
9740
|
-
case
|
|
9837
|
+
case 57:
|
|
9741
9838
|
this._needInitSegment = false;
|
|
9742
9839
|
p = [];
|
|
9743
9840
|
if (remuxResult.videoInitSegment)
|
|
@@ -9749,15 +9846,15 @@
|
|
|
9749
9846
|
if (remuxResult.audioSegment)
|
|
9750
9847
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9751
9848
|
return _context5.abrupt("return", Promise.all(p));
|
|
9752
|
-
case
|
|
9849
|
+
case 66:
|
|
9753
9850
|
if (this._softVideo) {
|
|
9754
9851
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
9755
9852
|
}
|
|
9756
|
-
case
|
|
9853
|
+
case 67:
|
|
9757
9854
|
case "end":
|
|
9758
9855
|
return _context5.stop();
|
|
9759
9856
|
}
|
|
9760
|
-
}, _callee5, this, [[4, 8], [47,
|
|
9857
|
+
}, _callee5, this, [[4, 8], [47, 52]]);
|
|
9761
9858
|
}));
|
|
9762
9859
|
function appendBuffer(_x2) {
|
|
9763
9860
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9929,7 +10026,9 @@
|
|
|
9929
10026
|
keepStatusAfterSwitch: true,
|
|
9930
10027
|
onlyVideo: false,
|
|
9931
10028
|
onlyAudio: false,
|
|
9932
|
-
preferMMS: false
|
|
10029
|
+
preferMMS: false,
|
|
10030
|
+
mseLowLatency: true,
|
|
10031
|
+
durationForMSELowLatencyOff: 6
|
|
9933
10032
|
}, opts);
|
|
9934
10033
|
if (ret.isLive) {
|
|
9935
10034
|
if (ret.preloadTime) {
|
|
@@ -9971,9 +10070,10 @@
|
|
|
9971
10070
|
}
|
|
9972
10071
|
var logger = new Logger$2("flv");
|
|
9973
10072
|
var MAX_HOLE = 0.1;
|
|
10073
|
+
var MAX_START_GAP = 0.3;
|
|
9974
10074
|
var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
9975
10075
|
_inherits$3(Flv2, _EventEmitter);
|
|
9976
|
-
var _super = _createSuper$
|
|
10076
|
+
var _super = _createSuper$2(Flv2);
|
|
9977
10077
|
function Flv2(_opts) {
|
|
9978
10078
|
var _this;
|
|
9979
10079
|
_classCallCheck$4(this, Flv2);
|
|
@@ -10141,7 +10241,10 @@
|
|
|
10141
10241
|
}
|
|
10142
10242
|
} else {
|
|
10143
10243
|
if (!media.currentTime && _this._gapService) {
|
|
10144
|
-
_this.
|
|
10244
|
+
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10245
|
+
if (gapJump) {
|
|
10246
|
+
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10247
|
+
}
|
|
10145
10248
|
return;
|
|
10146
10249
|
}
|
|
10147
10250
|
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
@@ -10163,6 +10266,14 @@
|
|
|
10163
10266
|
_this._tick();
|
|
10164
10267
|
}
|
|
10165
10268
|
});
|
|
10269
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "_onLoadeddata", function() {
|
|
10270
|
+
if (_this.isLive && !_this._opts.mseLowLatency) {
|
|
10271
|
+
if (_this.media.duration !== Infinity) {
|
|
10272
|
+
_this._bufferService.updateDuration(Infinity).catch(function(e) {
|
|
10273
|
+
});
|
|
10274
|
+
}
|
|
10275
|
+
}
|
|
10276
|
+
});
|
|
10166
10277
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onSeeking", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
10167
10278
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10168
10279
|
while (1)
|
|
@@ -10188,6 +10299,10 @@
|
|
|
10188
10299
|
var latency = bufferEnd - currentTime;
|
|
10189
10300
|
if (latency >= opts.maxLatency) {
|
|
10190
10301
|
_this.media.currentTime = bufferEnd - opts.targetLatency;
|
|
10302
|
+
_this.emit(EVENT.CHASEFRAME, {
|
|
10303
|
+
currentTime: _this.media.currentTime,
|
|
10304
|
+
latency: opts.targetLatency
|
|
10305
|
+
});
|
|
10191
10306
|
}
|
|
10192
10307
|
}
|
|
10193
10308
|
_this._seiService.throw(currentTime, true);
|
|
@@ -10289,6 +10404,7 @@
|
|
|
10289
10404
|
_this._gapService = new GapService();
|
|
10290
10405
|
}
|
|
10291
10406
|
_this.media.addEventListener("play", _this._onPlay);
|
|
10407
|
+
_this.media.addEventListener("loadeddata", _this._onLoadeddata);
|
|
10292
10408
|
_this.media.addEventListener("seeking", _this._onSeeking);
|
|
10293
10409
|
_this.media.addEventListener("timeupdate", _this._onTimeupdate);
|
|
10294
10410
|
_this.media.addEventListener("progress", _this._onBufferUpdate);
|
|
@@ -10299,7 +10415,7 @@
|
|
|
10299
10415
|
_createClass$4(Flv2, [{
|
|
10300
10416
|
key: "version",
|
|
10301
10417
|
get: function get() {
|
|
10302
|
-
return "3.0.
|
|
10418
|
+
return "3.0.17";
|
|
10303
10419
|
}
|
|
10304
10420
|
}, {
|
|
10305
10421
|
key: "isLive",
|
|
@@ -10473,10 +10589,10 @@
|
|
|
10473
10589
|
return this._clear();
|
|
10474
10590
|
case 10:
|
|
10475
10591
|
setTimeout(function() {
|
|
10476
|
-
_this3._loadData(url);
|
|
10477
|
-
_this3._bufferService.seamlessSwitch();
|
|
10478
10592
|
_this3._urlSwitching = true;
|
|
10479
10593
|
_this3._seamlessSwitching = true;
|
|
10594
|
+
_this3._loadData(url);
|
|
10595
|
+
_this3._bufferService.seamlessSwitch();
|
|
10480
10596
|
});
|
|
10481
10597
|
case 11:
|
|
10482
10598
|
case "end":
|
|
@@ -10506,16 +10622,17 @@
|
|
|
10506
10622
|
this.removeAllListeners();
|
|
10507
10623
|
this._seiService.reset();
|
|
10508
10624
|
this.media.removeEventListener("play", this._onPlay);
|
|
10625
|
+
this.media.removeEventListener("loadeddata", this._onLoadeddata);
|
|
10509
10626
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
10510
10627
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10511
10628
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10512
10629
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10513
|
-
_context7.next =
|
|
10630
|
+
_context7.next = 12;
|
|
10514
10631
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10515
|
-
case
|
|
10632
|
+
case 12:
|
|
10516
10633
|
this.media = null;
|
|
10517
10634
|
this._bufferService = null;
|
|
10518
|
-
case
|
|
10635
|
+
case 14:
|
|
10519
10636
|
case "end":
|
|
10520
10637
|
return _context7.stop();
|
|
10521
10638
|
}
|
|
@@ -10597,7 +10714,8 @@
|
|
|
10597
10714
|
}
|
|
10598
10715
|
this._mediaLoader.finnalUrl = finnalUrl;
|
|
10599
10716
|
this.emit(EVENT.LOAD_START, {
|
|
10600
|
-
url: finnalUrl
|
|
10717
|
+
url: finnalUrl,
|
|
10718
|
+
seamlessSwitching: this._seamlessSwitching
|
|
10601
10719
|
});
|
|
10602
10720
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10603
10721
|
if (!this._loading) {
|
|
@@ -10775,7 +10893,7 @@
|
|
|
10775
10893
|
}();
|
|
10776
10894
|
var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
10777
10895
|
_inherits$3(FlvPlugin2, _BasePlugin);
|
|
10778
|
-
var _super = _createSuper$
|
|
10896
|
+
var _super = _createSuper$2(FlvPlugin2);
|
|
10779
10897
|
function FlvPlugin2() {
|
|
10780
10898
|
var _this;
|
|
10781
10899
|
_classCallCheck$4(this, FlvPlugin2);
|
|
@@ -10919,6 +11037,7 @@
|
|
|
10919
11037
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
10920
11038
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
10921
11039
|
this._transCoreEvent(EVENT.KEYFRAME);
|
|
11040
|
+
this._transCoreEvent(EVENT.CHASEFRAME);
|
|
10922
11041
|
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
10923
11042
|
this._transCoreEvent(EVENT.SEI);
|
|
10924
11043
|
this._transCoreEvent(EVENT.SEI_IN_TIME);
|
|
@@ -10969,6 +11088,35 @@
|
|
|
10969
11088
|
return FlvPlugin2;
|
|
10970
11089
|
}(BasePlugin);
|
|
10971
11090
|
_defineProperty$3(FlvPlugin, "Flv", Flv);
|
|
11091
|
+
function _callSuper(t, o, e) {
|
|
11092
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
11093
|
+
}
|
|
11094
|
+
function _isNativeReflectConstruct() {
|
|
11095
|
+
try {
|
|
11096
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
11097
|
+
}));
|
|
11098
|
+
} catch (t2) {
|
|
11099
|
+
}
|
|
11100
|
+
return (_isNativeReflectConstruct = function() {
|
|
11101
|
+
return !!t;
|
|
11102
|
+
})();
|
|
11103
|
+
}
|
|
11104
|
+
function _toPrimitive(t, r) {
|
|
11105
|
+
if ("object" != typeof t || !t)
|
|
11106
|
+
return t;
|
|
11107
|
+
var e = t[Symbol.toPrimitive];
|
|
11108
|
+
if (void 0 !== e) {
|
|
11109
|
+
var i = e.call(t, r || "default");
|
|
11110
|
+
if ("object" != typeof i)
|
|
11111
|
+
return i;
|
|
11112
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11113
|
+
}
|
|
11114
|
+
return ("string" === r ? String : Number)(t);
|
|
11115
|
+
}
|
|
11116
|
+
function _toPropertyKey(t) {
|
|
11117
|
+
var i = _toPrimitive(t, "string");
|
|
11118
|
+
return "symbol" == typeof i ? i : String(i);
|
|
11119
|
+
}
|
|
10972
11120
|
function _classCallCheck(instance, Constructor) {
|
|
10973
11121
|
if (!(instance instanceof Constructor)) {
|
|
10974
11122
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -11024,21 +11172,6 @@
|
|
|
11024
11172
|
};
|
|
11025
11173
|
return _setPrototypeOf(o, p);
|
|
11026
11174
|
}
|
|
11027
|
-
function _isNativeReflectConstruct() {
|
|
11028
|
-
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
11029
|
-
return false;
|
|
11030
|
-
if (Reflect.construct.sham)
|
|
11031
|
-
return false;
|
|
11032
|
-
if (typeof Proxy === "function")
|
|
11033
|
-
return true;
|
|
11034
|
-
try {
|
|
11035
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
11036
|
-
}));
|
|
11037
|
-
return true;
|
|
11038
|
-
} catch (e) {
|
|
11039
|
-
return false;
|
|
11040
|
-
}
|
|
11041
|
-
}
|
|
11042
11175
|
function _assertThisInitialized(self2) {
|
|
11043
11176
|
if (self2 === void 0) {
|
|
11044
11177
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -11053,41 +11186,11 @@
|
|
|
11053
11186
|
}
|
|
11054
11187
|
return _assertThisInitialized(self2);
|
|
11055
11188
|
}
|
|
11056
|
-
function _createSuper(Derived) {
|
|
11057
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
11058
|
-
return function _createSuperInternal() {
|
|
11059
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
11060
|
-
if (hasNativeReflectConstruct) {
|
|
11061
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
11062
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
11063
|
-
} else {
|
|
11064
|
-
result = Super.apply(this, arguments);
|
|
11065
|
-
}
|
|
11066
|
-
return _possibleConstructorReturn(this, result);
|
|
11067
|
-
};
|
|
11068
|
-
}
|
|
11069
|
-
function _toPrimitive(input, hint) {
|
|
11070
|
-
if (typeof input !== "object" || input === null)
|
|
11071
|
-
return input;
|
|
11072
|
-
var prim = input[Symbol.toPrimitive];
|
|
11073
|
-
if (prim !== void 0) {
|
|
11074
|
-
var res = prim.call(input, hint || "default");
|
|
11075
|
-
if (typeof res !== "object")
|
|
11076
|
-
return res;
|
|
11077
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11078
|
-
}
|
|
11079
|
-
return (hint === "string" ? String : Number)(input);
|
|
11080
|
-
}
|
|
11081
|
-
function _toPropertyKey(arg) {
|
|
11082
|
-
var key = _toPrimitive(arg, "string");
|
|
11083
|
-
return typeof key === "symbol" ? key : String(key);
|
|
11084
|
-
}
|
|
11085
11189
|
var Adaptive = /* @__PURE__ */ function(_BasePlugin) {
|
|
11086
11190
|
_inherits(Adaptive2, _BasePlugin);
|
|
11087
|
-
var _super = _createSuper(Adaptive2);
|
|
11088
11191
|
function Adaptive2() {
|
|
11089
11192
|
_classCallCheck(this, Adaptive2);
|
|
11090
|
-
return
|
|
11193
|
+
return _callSuper(this, Adaptive2, arguments);
|
|
11091
11194
|
}
|
|
11092
11195
|
_createClass(Adaptive2, [{
|
|
11093
11196
|
key: "afterCreate",
|