@byteplus/veplayer-plugin 2.3.1-rc.2 → 2.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.d.ts +0 -1
- package/esm/index.development.js +20274 -35966
- package/esm/index.production.js +5 -5
- package/esm/veplayer.plugin.flv.development.js +281 -178
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +656 -261
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/package.json +21 -1
- package/umd/index.d.ts +0 -1
- package/umd/veplayer.plugin.flv.development.js +277 -174
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +650 -255
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.drm.development.js +0 -1577
- package/esm/veplayer.plugin.drm.production.js +0 -2
- package/esm/veplayer.plugin.mp4.development.js +0 -38039
- package/esm/veplayer.plugin.mp4.production.js +0 -2
- package/esm/veplayer.plugin.rtm.development.js +0 -5587
- package/esm/veplayer.plugin.rtm.production.js +0 -2
- package/esm/veplayer.plugin.shaka.development.js +0 -15973
- package/esm/veplayer.plugin.shaka.production.js +0 -20
- package/esm/veplayer.plugin.time.shift.development.css +0 -63
- package/esm/veplayer.plugin.time.shift.development.js +0 -339
- package/esm/veplayer.plugin.time.shift.production.css +0 -1
- package/esm/veplayer.plugin.time.shift.production.js +0 -2
- package/esm/veplayer.plugin.xgvideo.development.js +0 -19097
- package/esm/veplayer.plugin.xgvideo.production.js +0 -2
- package/umd/veplayer.plugin.drm.development.js +0 -1579
- package/umd/veplayer.plugin.drm.production.js +0 -1
- package/umd/veplayer.plugin.mp4.development.js +0 -38043
- package/umd/veplayer.plugin.mp4.production.js +0 -1
- package/umd/veplayer.plugin.rtm.development.js +0 -5589
- package/umd/veplayer.plugin.rtm.production.js +0 -1
- package/umd/veplayer.plugin.shaka.development.js +0 -15977
- package/umd/veplayer.plugin.shaka.production.js +0 -1
- package/umd/veplayer.plugin.time.shift.development.css +0 -63
- package/umd/veplayer.plugin.time.shift.development.js +0 -342
- package/umd/veplayer.plugin.time.shift.production.css +0 -1
- package/umd/veplayer.plugin.time.shift.production.js +0 -1
- package/umd/veplayer.plugin.xgvideo.development.js +0 -19099
- package/umd/veplayer.plugin.xgvideo.production.js +0 -1
|
@@ -470,7 +470,7 @@ function _possibleConstructorReturn$3(self, call) {
|
|
|
470
470
|
}
|
|
471
471
|
return _assertThisInitialized$3(self);
|
|
472
472
|
}
|
|
473
|
-
function _createSuper$
|
|
473
|
+
function _createSuper$2(Derived) {
|
|
474
474
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
475
475
|
return function _createSuperInternal() {
|
|
476
476
|
var Super = _getPrototypeOf$3(Derived), result;
|
|
@@ -1387,6 +1387,9 @@ util.cancelAnimationFrame = function(frameId) {
|
|
|
1387
1387
|
_fun && _fun(frameId);
|
|
1388
1388
|
};
|
|
1389
1389
|
util.isMSE = function(video) {
|
|
1390
|
+
if (video.media) {
|
|
1391
|
+
video = video.media;
|
|
1392
|
+
}
|
|
1390
1393
|
if (!video || !(video instanceof HTMLMediaElement)) {
|
|
1391
1394
|
return false;
|
|
1392
1395
|
}
|
|
@@ -1535,7 +1538,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1535
1538
|
}
|
|
1536
1539
|
return offsetTime;
|
|
1537
1540
|
};
|
|
1538
|
-
var version = "3.0.
|
|
1541
|
+
var version = "3.0.17";
|
|
1539
1542
|
var ERROR_MAP = {
|
|
1540
1543
|
1: 5101,
|
|
1541
1544
|
2: 5102,
|
|
@@ -2510,7 +2513,7 @@ function _possibleConstructorReturn$2(self, call) {
|
|
|
2510
2513
|
}
|
|
2511
2514
|
return _assertThisInitialized$2(self);
|
|
2512
2515
|
}
|
|
2513
|
-
function _createSuper$
|
|
2516
|
+
function _createSuper$1(Derived) {
|
|
2514
2517
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
2515
2518
|
return function _createSuperInternal() {
|
|
2516
2519
|
var Super = _getPrototypeOf$2(Derived), result;
|
|
@@ -2638,30 +2641,6 @@ function _toPropertyKey$2(arg) {
|
|
|
2638
2641
|
var key = _toPrimitive$2(arg, "string");
|
|
2639
2642
|
return typeof key === "symbol" ? key : String(key);
|
|
2640
2643
|
}
|
|
2641
|
-
function createPublicPromise() {
|
|
2642
|
-
var res, rej;
|
|
2643
|
-
var promise = new Promise(function(resolve, reject) {
|
|
2644
|
-
res = resolve;
|
|
2645
|
-
rej = reject;
|
|
2646
|
-
});
|
|
2647
|
-
promise.used = false;
|
|
2648
|
-
promise.resolve = function() {
|
|
2649
|
-
promise.used = true;
|
|
2650
|
-
return res.apply(void 0, arguments);
|
|
2651
|
-
};
|
|
2652
|
-
promise.reject = function() {
|
|
2653
|
-
promise.used = true;
|
|
2654
|
-
return rej.apply(void 0, arguments);
|
|
2655
|
-
};
|
|
2656
|
-
return promise;
|
|
2657
|
-
}
|
|
2658
|
-
function nowTime$1() {
|
|
2659
|
-
try {
|
|
2660
|
-
return parseInt(performance.now(), 10);
|
|
2661
|
-
} catch (e) {
|
|
2662
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
2644
|
var Buffer$1 = /* @__PURE__ */ function() {
|
|
2666
2645
|
function Buffer2() {
|
|
2667
2646
|
_classCallCheck$2(this, Buffer2);
|
|
@@ -2783,6 +2762,7 @@ var Buffer$1 = /* @__PURE__ */ function() {
|
|
|
2783
2762
|
}]);
|
|
2784
2763
|
return Buffer2;
|
|
2785
2764
|
}();
|
|
2765
|
+
var isBrowser$1 = typeof window !== "undefined";
|
|
2786
2766
|
var _ERR_CODE;
|
|
2787
2767
|
var ERR = {
|
|
2788
2768
|
MANIFEST: "manifest",
|
|
@@ -2859,7 +2839,7 @@ var ERR_CODE = (_ERR_CODE = {}, _defineProperty$1(_ERR_CODE, ERR.MANIFEST, {
|
|
|
2859
2839
|
}), _ERR_CODE);
|
|
2860
2840
|
var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
2861
2841
|
_inherits$2(StreamingError2, _Error);
|
|
2862
|
-
var _super = _createSuper$
|
|
2842
|
+
var _super = _createSuper$1(StreamingError2);
|
|
2863
2843
|
function StreamingError2(type, subType, origin, payload, msg) {
|
|
2864
2844
|
var _this;
|
|
2865
2845
|
_classCallCheck$2(this, StreamingError2);
|
|
@@ -2901,7 +2881,6 @@ var StreamingError = /* @__PURE__ */ function(_Error) {
|
|
|
2901
2881
|
}]);
|
|
2902
2882
|
return StreamingError2;
|
|
2903
2883
|
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
2904
|
-
var isBrowser$1 = typeof window !== "undefined";
|
|
2905
2884
|
var LogCacheLevel = {
|
|
2906
2885
|
"DEBUG": 1,
|
|
2907
2886
|
"LOG": 2,
|
|
@@ -2930,7 +2909,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
2930
2909
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
2931
2910
|
if (Logger2.disabled)
|
|
2932
2911
|
return;
|
|
2933
|
-
(_console = console).debug.apply(_console, [this._prefix, nowTime()].concat(args));
|
|
2912
|
+
(_console = console).debug.apply(_console, [this._prefix, nowTime$1()].concat(args));
|
|
2934
2913
|
}
|
|
2935
2914
|
}, {
|
|
2936
2915
|
key: "log",
|
|
@@ -2942,7 +2921,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
2942
2921
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
2943
2922
|
if (Logger2.disabled)
|
|
2944
2923
|
return;
|
|
2945
|
-
(_console2 = console).log.apply(_console2, [this._prefix, nowTime()].concat(args));
|
|
2924
|
+
(_console2 = console).log.apply(_console2, [this._prefix, nowTime$1()].concat(args));
|
|
2946
2925
|
}
|
|
2947
2926
|
}, {
|
|
2948
2927
|
key: "warn",
|
|
@@ -2954,7 +2933,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
2954
2933
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
2955
2934
|
if (Logger2.disabled)
|
|
2956
2935
|
return;
|
|
2957
|
-
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime()].concat(args));
|
|
2936
|
+
(_console3 = console).warn.apply(_console3, [this._prefix, nowTime$1()].concat(args));
|
|
2958
2937
|
}
|
|
2959
2938
|
}, {
|
|
2960
2939
|
key: "error",
|
|
@@ -2966,7 +2945,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
2966
2945
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
2967
2946
|
if (Logger2.disabled)
|
|
2968
2947
|
return;
|
|
2969
|
-
(_console4 = console).error.apply(_console4, [this._prefix, nowTime()].concat(args));
|
|
2948
|
+
(_console4 = console).error.apply(_console4, [this._prefix, nowTime$1()].concat(args));
|
|
2970
2949
|
}
|
|
2971
2950
|
}, {
|
|
2972
2951
|
key: "logCache",
|
|
@@ -2981,7 +2960,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
2981
2960
|
var finLogText = logText.map(function(item) {
|
|
2982
2961
|
return logable(item);
|
|
2983
2962
|
});
|
|
2984
|
-
text = this._prefix + nowTime() + JSON.stringify(finLogText);
|
|
2963
|
+
text = this._prefix + nowTime$1() + JSON.stringify(finLogText);
|
|
2985
2964
|
} catch (e) {
|
|
2986
2965
|
return;
|
|
2987
2966
|
}
|
|
@@ -3036,7 +3015,7 @@ var Logger$2 = /* @__PURE__ */ function() {
|
|
|
3036
3015
|
return Logger2;
|
|
3037
3016
|
}();
|
|
3038
3017
|
_defineProperty$1(Logger$2, "disabled", true);
|
|
3039
|
-
function nowTime() {
|
|
3018
|
+
function nowTime$1() {
|
|
3040
3019
|
return (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3041
3020
|
}
|
|
3042
3021
|
function reduceDepth(val) {
|
|
@@ -3084,6 +3063,46 @@ function logable(obj, maxDepth, depth) {
|
|
|
3084
3063
|
}
|
|
3085
3064
|
return result;
|
|
3086
3065
|
}
|
|
3066
|
+
function createPublicPromise() {
|
|
3067
|
+
var res, rej;
|
|
3068
|
+
var promise = new Promise(function(resolve, reject) {
|
|
3069
|
+
res = resolve;
|
|
3070
|
+
rej = reject;
|
|
3071
|
+
});
|
|
3072
|
+
promise.used = false;
|
|
3073
|
+
promise.resolve = function() {
|
|
3074
|
+
promise.used = true;
|
|
3075
|
+
return res.apply(void 0, arguments);
|
|
3076
|
+
};
|
|
3077
|
+
promise.reject = function() {
|
|
3078
|
+
promise.used = true;
|
|
3079
|
+
return rej.apply(void 0, arguments);
|
|
3080
|
+
};
|
|
3081
|
+
return promise;
|
|
3082
|
+
}
|
|
3083
|
+
function nowTime() {
|
|
3084
|
+
try {
|
|
3085
|
+
return parseInt(performance.now(), 10);
|
|
3086
|
+
} catch (e) {
|
|
3087
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
var SafeJSON = {
|
|
3091
|
+
stringify: function stringify(obj) {
|
|
3092
|
+
try {
|
|
3093
|
+
return JSON.stringify(obj);
|
|
3094
|
+
} catch (e) {
|
|
3095
|
+
return "";
|
|
3096
|
+
}
|
|
3097
|
+
},
|
|
3098
|
+
parse: function parse(obj) {
|
|
3099
|
+
try {
|
|
3100
|
+
return JSON.parse(obj);
|
|
3101
|
+
} catch (e) {
|
|
3102
|
+
return void 0;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
};
|
|
3087
3106
|
function getMediaSource() {
|
|
3088
3107
|
var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3089
3108
|
try {
|
|
@@ -3098,6 +3117,18 @@ function getMediaSource() {
|
|
|
3098
3117
|
function isMMS(mediaSource) {
|
|
3099
3118
|
return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
|
|
3100
3119
|
}
|
|
3120
|
+
function getTimeRanges(buffered) {
|
|
3121
|
+
var ranges = [];
|
|
3122
|
+
if (buffered instanceof TimeRanges) {
|
|
3123
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
3124
|
+
ranges.push({
|
|
3125
|
+
start: buffered.start(i),
|
|
3126
|
+
end: buffered.end(i)
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
return ranges;
|
|
3131
|
+
}
|
|
3101
3132
|
var OP_NAME = {
|
|
3102
3133
|
APPEND: "appendBuffer",
|
|
3103
3134
|
REMOVE: "removeBuffer",
|
|
@@ -3132,8 +3163,9 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3132
3163
|
queue.shift();
|
|
3133
3164
|
}
|
|
3134
3165
|
if (op) {
|
|
3135
|
-
var
|
|
3136
|
-
|
|
3166
|
+
var _this2$_sourceBuffer$;
|
|
3167
|
+
var costtime = nowTime() - _this2._opst;
|
|
3168
|
+
_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);
|
|
3137
3169
|
op.promise.resolve({
|
|
3138
3170
|
name: op.opName,
|
|
3139
3171
|
context: op.context,
|
|
@@ -3167,6 +3199,19 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3167
3199
|
var _this$mediaSource;
|
|
3168
3200
|
return ((_this$mediaSource = this.mediaSource) === null || _this$mediaSource === void 0 ? void 0 : _this$mediaSource.readyState) === "open";
|
|
3169
3201
|
}
|
|
3202
|
+
}, {
|
|
3203
|
+
key: "hasOpTasks",
|
|
3204
|
+
get: function get() {
|
|
3205
|
+
var _this3 = this;
|
|
3206
|
+
var flag = false;
|
|
3207
|
+
Object.keys(this._queue).forEach(function(k) {
|
|
3208
|
+
var queue = _this3._queue[k];
|
|
3209
|
+
if (Array.isArray(queue)) {
|
|
3210
|
+
flag || (flag = queue.length > 0);
|
|
3211
|
+
}
|
|
3212
|
+
});
|
|
3213
|
+
return flag;
|
|
3214
|
+
}
|
|
3170
3215
|
}, {
|
|
3171
3216
|
key: "url",
|
|
3172
3217
|
get: function get() {
|
|
@@ -3196,13 +3241,13 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3196
3241
|
}, {
|
|
3197
3242
|
key: "updateDuration",
|
|
3198
3243
|
value: function updateDuration(duration) {
|
|
3199
|
-
var
|
|
3244
|
+
var _this4 = this;
|
|
3200
3245
|
var isReduceDuration = this.mediaSource && this.mediaSource.duration > duration;
|
|
3201
3246
|
if (this.mediaSource && this.mediaSource.duration > duration) {
|
|
3202
3247
|
var bufferEnd = 0;
|
|
3203
3248
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3204
3249
|
try {
|
|
3205
|
-
bufferEnd = Math.max(
|
|
3250
|
+
bufferEnd = Math.max(_this4.bufferEnd(k) || 0, bufferEnd);
|
|
3206
3251
|
} catch (error) {
|
|
3207
3252
|
}
|
|
3208
3253
|
});
|
|
@@ -3211,13 +3256,13 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3211
3256
|
}
|
|
3212
3257
|
}
|
|
3213
3258
|
return this._enqueueBlockingOp(function() {
|
|
3214
|
-
if (
|
|
3215
|
-
|
|
3259
|
+
if (_this4.isEnded) {
|
|
3260
|
+
_this4._logger.debug("setDuration but ended");
|
|
3216
3261
|
return;
|
|
3217
3262
|
}
|
|
3218
|
-
if (
|
|
3219
|
-
|
|
3220
|
-
|
|
3263
|
+
if (_this4.mediaSource) {
|
|
3264
|
+
_this4.mediaSource.duration = duration;
|
|
3265
|
+
_this4._logger.debug("setDuration", duration);
|
|
3221
3266
|
}
|
|
3222
3267
|
}, OP_NAME.UPDATE_DURATION, {
|
|
3223
3268
|
isReduceDuration
|
|
@@ -3226,14 +3271,14 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3226
3271
|
}, {
|
|
3227
3272
|
key: "open",
|
|
3228
3273
|
value: function open() {
|
|
3229
|
-
var
|
|
3274
|
+
var _this5 = this;
|
|
3230
3275
|
if (this._openPromise.used && !this.isOpened && this.mediaSource) {
|
|
3231
3276
|
var ms = this.mediaSource;
|
|
3232
3277
|
var onOpen = function onOpen2() {
|
|
3233
|
-
var costTime = nowTime
|
|
3234
|
-
|
|
3278
|
+
var costTime = nowTime() - _this5._st;
|
|
3279
|
+
_this5._logger.debug("sourceopen", costTime);
|
|
3235
3280
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3236
|
-
|
|
3281
|
+
_this5._openPromise.resolve({
|
|
3237
3282
|
costtime: costTime
|
|
3238
3283
|
});
|
|
3239
3284
|
};
|
|
@@ -3246,8 +3291,8 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3246
3291
|
key: "bindMedia",
|
|
3247
3292
|
value: function() {
|
|
3248
3293
|
var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
|
|
3249
|
-
var
|
|
3250
|
-
var
|
|
3294
|
+
var _this6 = this;
|
|
3295
|
+
var MediaSource2, ms, useMMS, onOpen;
|
|
3251
3296
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3252
3297
|
while (1)
|
|
3253
3298
|
switch (_context.prev = _context.next) {
|
|
@@ -3259,23 +3304,23 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3259
3304
|
_context.next = 3;
|
|
3260
3305
|
return this.unbindMedia();
|
|
3261
3306
|
case 3:
|
|
3262
|
-
|
|
3263
|
-
if (!(!media || !
|
|
3307
|
+
MediaSource2 = getMediaSource(this._config.preferMMS);
|
|
3308
|
+
if (!(!media || !MediaSource2)) {
|
|
3264
3309
|
_context.next = 6;
|
|
3265
3310
|
break;
|
|
3266
3311
|
}
|
|
3267
3312
|
throw new Error("Param media or MediaSource does not exist");
|
|
3268
3313
|
case 6:
|
|
3269
3314
|
this.media = media;
|
|
3270
|
-
ms = this.mediaSource = new
|
|
3315
|
+
ms = this.mediaSource = new MediaSource2();
|
|
3271
3316
|
useMMS = isMMS(ms);
|
|
3272
|
-
this._st = nowTime
|
|
3317
|
+
this._st = nowTime();
|
|
3273
3318
|
onOpen = function onOpen2() {
|
|
3274
|
-
var costTime = nowTime
|
|
3275
|
-
|
|
3319
|
+
var costTime = nowTime() - _this6._st;
|
|
3320
|
+
_this6._logger.debug("sourceopen");
|
|
3276
3321
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3277
3322
|
URL.revokeObjectURL(media.src);
|
|
3278
|
-
|
|
3323
|
+
_this6._openPromise.resolve({
|
|
3279
3324
|
costtime: costTime
|
|
3280
3325
|
});
|
|
3281
3326
|
};
|
|
@@ -3303,7 +3348,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3303
3348
|
key: "unbindMedia",
|
|
3304
3349
|
value: function() {
|
|
3305
3350
|
var _unbindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
|
|
3306
|
-
var
|
|
3351
|
+
var _this7 = this;
|
|
3307
3352
|
var ms, hasMetadata, mseOpen;
|
|
3308
3353
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3309
3354
|
while (1)
|
|
@@ -3314,7 +3359,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3314
3359
|
ms = this.mediaSource;
|
|
3315
3360
|
if (ms) {
|
|
3316
3361
|
Object.keys(this._queue).forEach(function(t) {
|
|
3317
|
-
var queue =
|
|
3362
|
+
var queue = _this7._queue[t];
|
|
3318
3363
|
if (queue) {
|
|
3319
3364
|
queue.forEach(function(x) {
|
|
3320
3365
|
var _x$promise, _x$promise$resolve;
|
|
@@ -3332,7 +3377,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3332
3377
|
}
|
|
3333
3378
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3334
3379
|
try {
|
|
3335
|
-
ms.removeSourceBuffer(
|
|
3380
|
+
ms.removeSourceBuffer(_this7._sourceBuffer[k]);
|
|
3336
3381
|
} catch (error) {
|
|
3337
3382
|
}
|
|
3338
3383
|
});
|
|
@@ -3383,7 +3428,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3383
3428
|
}, {
|
|
3384
3429
|
key: "changeType",
|
|
3385
3430
|
value: function changeType(type, mimeType) {
|
|
3386
|
-
var
|
|
3431
|
+
var _this8 = this;
|
|
3387
3432
|
var sb = this._sourceBuffer[type];
|
|
3388
3433
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3389
3434
|
return Promise.resolve();
|
|
@@ -3392,7 +3437,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3392
3437
|
return this._enqueueOp(type, function() {
|
|
3393
3438
|
sb.changeType(mimeType);
|
|
3394
3439
|
sb.mimeType = mimeType;
|
|
3395
|
-
|
|
3440
|
+
_this8._onSBUpdateEnd(type);
|
|
3396
3441
|
}, "changeType", {
|
|
3397
3442
|
mimeType
|
|
3398
3443
|
});
|
|
@@ -3406,60 +3451,60 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3406
3451
|
}, {
|
|
3407
3452
|
key: "append",
|
|
3408
3453
|
value: function append(type, buffer, context) {
|
|
3409
|
-
var
|
|
3454
|
+
var _this9 = this;
|
|
3410
3455
|
if (!buffer || !buffer.byteLength) {
|
|
3411
3456
|
return Promise.resolve();
|
|
3412
3457
|
}
|
|
3413
3458
|
if (!this._sourceBuffer[type])
|
|
3414
3459
|
return Promise.resolve();
|
|
3415
3460
|
return this._enqueueOp(type, function() {
|
|
3416
|
-
var
|
|
3417
|
-
if (!
|
|
3461
|
+
var _this9$_sourceBuffer$;
|
|
3462
|
+
if (!_this9.mediaSource || _this9.media.error)
|
|
3418
3463
|
return;
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
(
|
|
3464
|
+
_this9._logger.debug("MSE APPEND START", context);
|
|
3465
|
+
_this9._opst = nowTime();
|
|
3466
|
+
(_this9$_sourceBuffer$ = _this9._sourceBuffer[type]) === null || _this9$_sourceBuffer$ === void 0 ? void 0 : _this9$_sourceBuffer$.appendBuffer(buffer);
|
|
3422
3467
|
}, OP_NAME.APPEND, context);
|
|
3423
3468
|
}
|
|
3424
3469
|
}, {
|
|
3425
3470
|
key: "remove",
|
|
3426
3471
|
value: function remove(type, startTime, endTime, context) {
|
|
3427
|
-
var
|
|
3472
|
+
var _this10 = this;
|
|
3428
3473
|
var isInsertHead = false;
|
|
3429
3474
|
if (this._mseFullFlag[type]) {
|
|
3430
3475
|
isInsertHead = true;
|
|
3431
3476
|
}
|
|
3432
3477
|
return this._enqueueOp(type, function() {
|
|
3433
|
-
if (!
|
|
3478
|
+
if (!_this10.mediaSource || _this10.media.error)
|
|
3434
3479
|
return;
|
|
3435
|
-
var sb =
|
|
3480
|
+
var sb = _this10._sourceBuffer[type];
|
|
3436
3481
|
if (startTime >= endTime || !sb) {
|
|
3437
|
-
|
|
3482
|
+
_this10._onSBUpdateEnd(type);
|
|
3438
3483
|
return;
|
|
3439
3484
|
}
|
|
3440
|
-
|
|
3441
|
-
|
|
3485
|
+
_this10._opst = nowTime();
|
|
3486
|
+
_this10._logger.debug("MSE REMOVE START", type, startTime, endTime, context);
|
|
3442
3487
|
sb.remove(startTime, endTime);
|
|
3443
3488
|
}, OP_NAME.REMOVE, context, isInsertHead);
|
|
3444
3489
|
}
|
|
3445
3490
|
}, {
|
|
3446
3491
|
key: "clearBuffer",
|
|
3447
3492
|
value: function clearBuffer(startTime, endTime) {
|
|
3448
|
-
var
|
|
3493
|
+
var _this11 = this;
|
|
3449
3494
|
var p;
|
|
3450
3495
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3451
|
-
p =
|
|
3496
|
+
p = _this11.remove(k, startTime, endTime);
|
|
3452
3497
|
});
|
|
3453
3498
|
return p || Promise.resolve();
|
|
3454
3499
|
}
|
|
3455
3500
|
}, {
|
|
3456
3501
|
key: "clearAllBuffer",
|
|
3457
3502
|
value: function clearAllBuffer() {
|
|
3458
|
-
var
|
|
3503
|
+
var _this12 = this;
|
|
3459
3504
|
var p;
|
|
3460
3505
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3461
|
-
var sb =
|
|
3462
|
-
p =
|
|
3506
|
+
var sb = _this12._sourceBuffer[k];
|
|
3507
|
+
p = _this12.remove(k, 0, Buffer$1.end(Buffer$1.get(sb)));
|
|
3463
3508
|
});
|
|
3464
3509
|
return p;
|
|
3465
3510
|
}
|
|
@@ -3487,14 +3532,14 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3487
3532
|
}, {
|
|
3488
3533
|
key: "endOfStream",
|
|
3489
3534
|
value: function endOfStream(reason) {
|
|
3490
|
-
var
|
|
3535
|
+
var _this13 = this;
|
|
3491
3536
|
if (!this.mediaSource || this.mediaSource.readyState !== "open")
|
|
3492
3537
|
return Promise.resolve();
|
|
3493
3538
|
return this._enqueueBlockingOp(function() {
|
|
3494
|
-
var ms =
|
|
3539
|
+
var ms = _this13.mediaSource;
|
|
3495
3540
|
if (!ms || ms.readyState !== "open")
|
|
3496
3541
|
return;
|
|
3497
|
-
|
|
3542
|
+
_this13._logger.debug("MSE endOfStream START");
|
|
3498
3543
|
if (reason) {
|
|
3499
3544
|
ms.endOfStream(reason);
|
|
3500
3545
|
} else {
|
|
@@ -3533,7 +3578,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3533
3578
|
}, {
|
|
3534
3579
|
key: "_enqueueOp",
|
|
3535
3580
|
value: function _enqueueOp(type, exec, opName, context, isInsertHead) {
|
|
3536
|
-
var
|
|
3581
|
+
var _this14 = this;
|
|
3537
3582
|
if (!this.mediaSource)
|
|
3538
3583
|
return Promise.resolve();
|
|
3539
3584
|
var queue = this._queue[type] = this._queue[type] || [];
|
|
@@ -3557,7 +3602,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3557
3602
|
} else {
|
|
3558
3603
|
this._openPromise.then(function() {
|
|
3559
3604
|
if (queue.length === 1) {
|
|
3560
|
-
|
|
3605
|
+
_this14._startQueue(type);
|
|
3561
3606
|
}
|
|
3562
3607
|
});
|
|
3563
3608
|
}
|
|
@@ -3567,7 +3612,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3567
3612
|
key: "_enqueueBlockingOp",
|
|
3568
3613
|
value: function() {
|
|
3569
3614
|
var _enqueueBlockingOp2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(exec, opName, context) {
|
|
3570
|
-
var
|
|
3615
|
+
var _this15 = this;
|
|
3571
3616
|
var types, waiters;
|
|
3572
3617
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3573
3618
|
while (1)
|
|
@@ -3588,7 +3633,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3588
3633
|
case 5:
|
|
3589
3634
|
waiters = [];
|
|
3590
3635
|
types.forEach(function(t) {
|
|
3591
|
-
var queue =
|
|
3636
|
+
var queue = _this15._queue[t];
|
|
3592
3637
|
var prom = createPublicPromise();
|
|
3593
3638
|
waiters.push(prom);
|
|
3594
3639
|
queue.push({
|
|
@@ -3600,7 +3645,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3600
3645
|
context
|
|
3601
3646
|
});
|
|
3602
3647
|
if (queue.length === 1) {
|
|
3603
|
-
|
|
3648
|
+
_this15._startQueue(t);
|
|
3604
3649
|
}
|
|
3605
3650
|
});
|
|
3606
3651
|
return _context3.abrupt("return", Promise.all(waiters).then(function() {
|
|
@@ -3608,11 +3653,11 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3608
3653
|
return exec();
|
|
3609
3654
|
} finally {
|
|
3610
3655
|
types.forEach(function(t) {
|
|
3611
|
-
var queue =
|
|
3612
|
-
var sb =
|
|
3656
|
+
var queue = _this15._queue[t];
|
|
3657
|
+
var sb = _this15._sourceBuffer[t];
|
|
3613
3658
|
queue === null || queue === void 0 ? void 0 : queue.shift();
|
|
3614
3659
|
if (!sb || !sb.updating) {
|
|
3615
|
-
|
|
3660
|
+
_this15._startQueue(t);
|
|
3616
3661
|
}
|
|
3617
3662
|
});
|
|
3618
3663
|
}
|
|
@@ -3655,41 +3700,46 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3655
3700
|
}, {
|
|
3656
3701
|
key: "setTimeoffset",
|
|
3657
3702
|
value: function setTimeoffset(type, timestampOffset, context) {
|
|
3658
|
-
var
|
|
3703
|
+
var _this16 = this;
|
|
3659
3704
|
return this._enqueueOp(type, function() {
|
|
3660
3705
|
if (timestampOffset < 0) {
|
|
3661
3706
|
timestampOffset += 1e-3;
|
|
3662
3707
|
}
|
|
3663
|
-
|
|
3664
|
-
|
|
3708
|
+
_this16._sourceBuffer[type].timestampOffset = timestampOffset;
|
|
3709
|
+
_this16._onSBUpdateEnd(type);
|
|
3665
3710
|
}, "setTimeoffset", context);
|
|
3666
3711
|
}
|
|
3667
3712
|
}, {
|
|
3668
3713
|
key: "abort",
|
|
3669
3714
|
value: function abort(type, context) {
|
|
3670
|
-
var
|
|
3715
|
+
var _this17 = this;
|
|
3671
3716
|
if (!this.isOpened) {
|
|
3672
3717
|
return Promise.resolve();
|
|
3673
3718
|
}
|
|
3674
3719
|
return this._enqueueOp(type, function() {
|
|
3675
|
-
|
|
3676
|
-
|
|
3720
|
+
_this17._sourceBuffer[type].abort();
|
|
3721
|
+
_this17._onSBUpdateEnd(type);
|
|
3677
3722
|
}, "abort", context);
|
|
3678
3723
|
}
|
|
3679
3724
|
}], [{
|
|
3680
3725
|
key: "isSupported",
|
|
3681
3726
|
value: function isSupported() {
|
|
3682
3727
|
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3683
|
-
var
|
|
3684
|
-
if (!
|
|
3728
|
+
var MediaSource2 = getMediaSource();
|
|
3729
|
+
if (!MediaSource2)
|
|
3685
3730
|
return false;
|
|
3686
3731
|
try {
|
|
3687
|
-
return
|
|
3732
|
+
return MediaSource2.isTypeSupported(mime);
|
|
3688
3733
|
} catch (error) {
|
|
3689
3734
|
this._logger.error(mime, error);
|
|
3690
3735
|
return false;
|
|
3691
3736
|
}
|
|
3692
3737
|
}
|
|
3738
|
+
}, {
|
|
3739
|
+
key: "isMMSOnly",
|
|
3740
|
+
value: function isMMSOnly() {
|
|
3741
|
+
return typeof ManagedMediaSource !== "undefined" && typeof MediaSource === "undefined";
|
|
3742
|
+
}
|
|
3693
3743
|
}, {
|
|
3694
3744
|
key: "getDefaultConfig",
|
|
3695
3745
|
value: function getDefaultConfig() {
|
|
@@ -3714,7 +3764,7 @@ var ResponseType = {
|
|
|
3714
3764
|
};
|
|
3715
3765
|
var NetError = /* @__PURE__ */ function(_Error) {
|
|
3716
3766
|
_inherits$2(NetError2, _Error);
|
|
3717
|
-
var _super = _createSuper$
|
|
3767
|
+
var _super = _createSuper$1(NetError2);
|
|
3718
3768
|
function NetError2(url, request, response, msg) {
|
|
3719
3769
|
var _this;
|
|
3720
3770
|
_classCallCheck$2(this, NetError2);
|
|
@@ -3825,10 +3875,12 @@ var EVENT = {
|
|
|
3825
3875
|
LOAD_COMPLETE: "core.loadcomplete",
|
|
3826
3876
|
LOAD_RETRY: "core.loadretry",
|
|
3827
3877
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3878
|
+
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3828
3879
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3829
3880
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3830
3881
|
BUFFEREOS: "core.buffereos",
|
|
3831
3882
|
KEYFRAME: "core.keyframe",
|
|
3883
|
+
CHASEFRAME: "core.chaseframe",
|
|
3832
3884
|
METADATA_PARSED: "core.metadataparsed",
|
|
3833
3885
|
SEI: "core.sei",
|
|
3834
3886
|
SEI_IN_TIME: "core.seiintime",
|
|
@@ -3852,7 +3904,7 @@ var EVENT = {
|
|
|
3852
3904
|
var CACHESIZE = 2 * 1024 * 1024;
|
|
3853
3905
|
var FetchLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
3854
3906
|
_inherits$2(FetchLoader2, _EventEmitter);
|
|
3855
|
-
var _super = _createSuper$
|
|
3907
|
+
var _super = _createSuper$1(FetchLoader2);
|
|
3856
3908
|
function FetchLoader2() {
|
|
3857
3909
|
var _this;
|
|
3858
3910
|
_classCallCheck$2(this, FetchLoader2);
|
|
@@ -4304,7 +4356,7 @@ function getConfig(cfg) {
|
|
|
4304
4356
|
}
|
|
4305
4357
|
var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4306
4358
|
_inherits$2(XhrLoader2, _EventEmitter);
|
|
4307
|
-
var _super = _createSuper$
|
|
4359
|
+
var _super = _createSuper$1(XhrLoader2);
|
|
4308
4360
|
function XhrLoader2() {
|
|
4309
4361
|
var _this;
|
|
4310
4362
|
_classCallCheck$2(this, XhrLoader2);
|
|
@@ -4788,7 +4840,7 @@ function sleep() {
|
|
|
4788
4840
|
}
|
|
4789
4841
|
var NetLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4790
4842
|
_inherits$2(NetLoader2, _EventEmitter);
|
|
4791
|
-
var _super = _createSuper$
|
|
4843
|
+
var _super = _createSuper$1(NetLoader2);
|
|
4792
4844
|
function NetLoader2(cfg) {
|
|
4793
4845
|
var _this;
|
|
4794
4846
|
_classCallCheck$2(this, NetLoader2);
|
|
@@ -5331,7 +5383,7 @@ function _possibleConstructorReturn$1(self, call) {
|
|
|
5331
5383
|
}
|
|
5332
5384
|
return _assertThisInitialized$1(self);
|
|
5333
5385
|
}
|
|
5334
|
-
function _createSuper
|
|
5386
|
+
function _createSuper(Derived) {
|
|
5335
5387
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
5336
5388
|
return function _createSuperInternal() {
|
|
5337
5389
|
var Super = _getPrototypeOf$1(Derived), result;
|
|
@@ -5475,6 +5527,26 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5475
5527
|
this.warnings = [];
|
|
5476
5528
|
this.hvcC = null;
|
|
5477
5529
|
}
|
|
5530
|
+
}, {
|
|
5531
|
+
key: "firstDts",
|
|
5532
|
+
get: function get() {
|
|
5533
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5534
|
+
}
|
|
5535
|
+
}, {
|
|
5536
|
+
key: "firstPts",
|
|
5537
|
+
get: function get() {
|
|
5538
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5539
|
+
}
|
|
5540
|
+
}, {
|
|
5541
|
+
key: "samplesDuration",
|
|
5542
|
+
get: function get() {
|
|
5543
|
+
if (this.samples.length > 0) {
|
|
5544
|
+
var first = this.samples[0];
|
|
5545
|
+
var last = this.samples[this.samples.length - 1];
|
|
5546
|
+
return last.dts - first.dts + last.duration;
|
|
5547
|
+
}
|
|
5548
|
+
return 0;
|
|
5549
|
+
}
|
|
5478
5550
|
}, {
|
|
5479
5551
|
key: "exist",
|
|
5480
5552
|
value: function exist() {
|
|
@@ -5553,6 +5625,26 @@ var AudioTrack = /* @__PURE__ */ function() {
|
|
|
5553
5625
|
get: function get() {
|
|
5554
5626
|
return this.isAudioEncryption;
|
|
5555
5627
|
}
|
|
5628
|
+
}, {
|
|
5629
|
+
key: "firstDts",
|
|
5630
|
+
get: function get() {
|
|
5631
|
+
return this.samples.length ? this.samples[0].dts : null;
|
|
5632
|
+
}
|
|
5633
|
+
}, {
|
|
5634
|
+
key: "firstPts",
|
|
5635
|
+
get: function get() {
|
|
5636
|
+
return this.samples.length ? this.samples[0].pts : null;
|
|
5637
|
+
}
|
|
5638
|
+
}, {
|
|
5639
|
+
key: "samplesDuration",
|
|
5640
|
+
get: function get() {
|
|
5641
|
+
if (this.samples.length > 0) {
|
|
5642
|
+
var first = this.samples[0];
|
|
5643
|
+
var last = this.samples[this.samples.length - 1];
|
|
5644
|
+
return last.dts - first.dts + last.duration;
|
|
5645
|
+
}
|
|
5646
|
+
return 0;
|
|
5647
|
+
}
|
|
5556
5648
|
}]);
|
|
5557
5649
|
return AudioTrack2;
|
|
5558
5650
|
}();
|
|
@@ -5613,7 +5705,7 @@ var Sample = /* @__PURE__ */ _createClass$1(
|
|
|
5613
5705
|
);
|
|
5614
5706
|
var FlvScriptSample = /* @__PURE__ */ function(_Sample) {
|
|
5615
5707
|
_inherits$1(FlvScriptSample2, _Sample);
|
|
5616
|
-
var _super = _createSuper
|
|
5708
|
+
var _super = _createSuper(FlvScriptSample2);
|
|
5617
5709
|
function FlvScriptSample2() {
|
|
5618
5710
|
_classCallCheck$1(this, FlvScriptSample2);
|
|
5619
5711
|
return _super.apply(this, arguments);
|
|
@@ -5622,7 +5714,7 @@ var FlvScriptSample = /* @__PURE__ */ function(_Sample) {
|
|
|
5622
5714
|
}(Sample);
|
|
5623
5715
|
var SeiSample = /* @__PURE__ */ function(_Sample2) {
|
|
5624
5716
|
_inherits$1(SeiSample2, _Sample2);
|
|
5625
|
-
var _super2 = _createSuper
|
|
5717
|
+
var _super2 = _createSuper(SeiSample2);
|
|
5626
5718
|
function SeiSample2() {
|
|
5627
5719
|
_classCallCheck$1(this, SeiSample2);
|
|
5628
5720
|
return _super2.apply(this, arguments);
|
|
@@ -6230,7 +6322,7 @@ function getAvcCodec(codecs) {
|
|
|
6230
6322
|
}
|
|
6231
6323
|
return codec;
|
|
6232
6324
|
}
|
|
6233
|
-
function
|
|
6325
|
+
function parse2(a) {
|
|
6234
6326
|
if (!Array.isArray(a)) {
|
|
6235
6327
|
var arr = [];
|
|
6236
6328
|
var value = "";
|
|
@@ -6980,7 +7072,7 @@ var AMF = /* @__PURE__ */ function() {
|
|
|
6980
7072
|
}
|
|
6981
7073
|
_createClass$1(AMF2, null, [{
|
|
6982
7074
|
key: "parse",
|
|
6983
|
-
value: function
|
|
7075
|
+
value: function parse3(data) {
|
|
6984
7076
|
if (data.length < 3)
|
|
6985
7077
|
return;
|
|
6986
7078
|
var ret = {};
|
|
@@ -7545,7 +7637,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
7545
7637
|
0,
|
|
7546
7638
|
0,
|
|
7547
7639
|
0
|
|
7548
|
-
].concat([16, 119, 239, 236, 192, 178, 77, 2, 172, 227, 60, 30, 82, 226, 251, 75], [0, 0, 0, 1],
|
|
7640
|
+
].concat([16, 119, 239, 236, 192, 178, 77, 2, 172, 227, 60, 30, 82, 226, 251, 75], [0, 0, 0, 1], parse2(data.kid), [0, 0, 0, 0]));
|
|
7549
7641
|
return MP42.box(MP42.types.pssh, content);
|
|
7550
7642
|
}
|
|
7551
7643
|
}, {
|
|
@@ -8033,7 +8125,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8033
8125
|
0,
|
|
8034
8126
|
data.default_IsEncrypted & 255,
|
|
8035
8127
|
data.default_IV_size & 255
|
|
8036
|
-
].concat(
|
|
8128
|
+
].concat(parse2(data.default_KID)));
|
|
8037
8129
|
return MP42.box(MP42.types.tenc, content);
|
|
8038
8130
|
}
|
|
8039
8131
|
}, {
|
|
@@ -9420,7 +9512,8 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
9420
9512
|
}();
|
|
9421
9513
|
var logger$1 = new Logger$2("BufferService");
|
|
9422
9514
|
var BufferService = /* @__PURE__ */ function() {
|
|
9423
|
-
function BufferService2(flv, softVideo
|
|
9515
|
+
function BufferService2(flv, softVideo) {
|
|
9516
|
+
var opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
9424
9517
|
_classCallCheck$4(this, BufferService2);
|
|
9425
9518
|
_defineProperty$3(this, "flv", null);
|
|
9426
9519
|
_defineProperty$3(this, "_demuxer", new FlvDemuxer());
|
|
@@ -9698,7 +9791,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9698
9791
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9699
9792
|
}
|
|
9700
9793
|
if (!mse) {
|
|
9701
|
-
_context5.next =
|
|
9794
|
+
_context5.next = 66;
|
|
9702
9795
|
break;
|
|
9703
9796
|
}
|
|
9704
9797
|
if (this._sourceCreated) {
|
|
@@ -9720,20 +9813,24 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9720
9813
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9721
9814
|
case 47:
|
|
9722
9815
|
_context5.prev = 47;
|
|
9816
|
+
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
9817
|
+
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
9818
|
+
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
9819
|
+
}
|
|
9723
9820
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9724
|
-
_context5.next =
|
|
9821
|
+
_context5.next = 55;
|
|
9725
9822
|
break;
|
|
9726
|
-
case
|
|
9727
|
-
_context5.prev =
|
|
9823
|
+
case 52:
|
|
9824
|
+
_context5.prev = 52;
|
|
9728
9825
|
_context5.t1 = _context5["catch"](47);
|
|
9729
9826
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9730
|
-
case
|
|
9827
|
+
case 55:
|
|
9731
9828
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9732
|
-
_context5.next =
|
|
9829
|
+
_context5.next = 57;
|
|
9733
9830
|
break;
|
|
9734
9831
|
}
|
|
9735
9832
|
return _context5.abrupt("return");
|
|
9736
|
-
case
|
|
9833
|
+
case 57:
|
|
9737
9834
|
this._needInitSegment = false;
|
|
9738
9835
|
p = [];
|
|
9739
9836
|
if (remuxResult.videoInitSegment)
|
|
@@ -9745,15 +9842,15 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9745
9842
|
if (remuxResult.audioSegment)
|
|
9746
9843
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9747
9844
|
return _context5.abrupt("return", Promise.all(p));
|
|
9748
|
-
case
|
|
9845
|
+
case 66:
|
|
9749
9846
|
if (this._softVideo) {
|
|
9750
9847
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
9751
9848
|
}
|
|
9752
|
-
case
|
|
9849
|
+
case 67:
|
|
9753
9850
|
case "end":
|
|
9754
9851
|
return _context5.stop();
|
|
9755
9852
|
}
|
|
9756
|
-
}, _callee5, this, [[4, 8], [47,
|
|
9853
|
+
}, _callee5, this, [[4, 8], [47, 52]]);
|
|
9757
9854
|
}));
|
|
9758
9855
|
function appendBuffer(_x2) {
|
|
9759
9856
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9925,7 +10022,9 @@ function getOption(opts) {
|
|
|
9925
10022
|
keepStatusAfterSwitch: true,
|
|
9926
10023
|
onlyVideo: false,
|
|
9927
10024
|
onlyAudio: false,
|
|
9928
|
-
preferMMS: false
|
|
10025
|
+
preferMMS: false,
|
|
10026
|
+
mseLowLatency: true,
|
|
10027
|
+
durationForMSELowLatencyOff: 6
|
|
9929
10028
|
}, opts);
|
|
9930
10029
|
if (ret.isLive) {
|
|
9931
10030
|
if (ret.preloadTime) {
|
|
@@ -9967,9 +10066,10 @@ function searchKeyframeIndex(list, value) {
|
|
|
9967
10066
|
}
|
|
9968
10067
|
var logger = new Logger$2("flv");
|
|
9969
10068
|
var MAX_HOLE = 0.1;
|
|
10069
|
+
var MAX_START_GAP = 0.3;
|
|
9970
10070
|
var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
9971
10071
|
_inherits$3(Flv2, _EventEmitter);
|
|
9972
|
-
var _super = _createSuper$
|
|
10072
|
+
var _super = _createSuper$2(Flv2);
|
|
9973
10073
|
function Flv2(_opts) {
|
|
9974
10074
|
var _this;
|
|
9975
10075
|
_classCallCheck$4(this, Flv2);
|
|
@@ -10137,7 +10237,10 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10137
10237
|
}
|
|
10138
10238
|
} else {
|
|
10139
10239
|
if (!media.currentTime && _this._gapService) {
|
|
10140
|
-
_this.
|
|
10240
|
+
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10241
|
+
if (gapJump) {
|
|
10242
|
+
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10243
|
+
}
|
|
10141
10244
|
return;
|
|
10142
10245
|
}
|
|
10143
10246
|
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
@@ -10159,6 +10262,14 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10159
10262
|
_this._tick();
|
|
10160
10263
|
}
|
|
10161
10264
|
});
|
|
10265
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "_onLoadeddata", function() {
|
|
10266
|
+
if (_this.isLive && !_this._opts.mseLowLatency) {
|
|
10267
|
+
if (_this.media.duration !== Infinity) {
|
|
10268
|
+
_this._bufferService.updateDuration(Infinity).catch(function(e) {
|
|
10269
|
+
});
|
|
10270
|
+
}
|
|
10271
|
+
}
|
|
10272
|
+
});
|
|
10162
10273
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onSeeking", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
10163
10274
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10164
10275
|
while (1)
|
|
@@ -10184,6 +10295,10 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10184
10295
|
var latency = bufferEnd - currentTime;
|
|
10185
10296
|
if (latency >= opts.maxLatency) {
|
|
10186
10297
|
_this.media.currentTime = bufferEnd - opts.targetLatency;
|
|
10298
|
+
_this.emit(EVENT.CHASEFRAME, {
|
|
10299
|
+
currentTime: _this.media.currentTime,
|
|
10300
|
+
latency: opts.targetLatency
|
|
10301
|
+
});
|
|
10187
10302
|
}
|
|
10188
10303
|
}
|
|
10189
10304
|
_this._seiService.throw(currentTime, true);
|
|
@@ -10285,6 +10400,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10285
10400
|
_this._gapService = new GapService();
|
|
10286
10401
|
}
|
|
10287
10402
|
_this.media.addEventListener("play", _this._onPlay);
|
|
10403
|
+
_this.media.addEventListener("loadeddata", _this._onLoadeddata);
|
|
10288
10404
|
_this.media.addEventListener("seeking", _this._onSeeking);
|
|
10289
10405
|
_this.media.addEventListener("timeupdate", _this._onTimeupdate);
|
|
10290
10406
|
_this.media.addEventListener("progress", _this._onBufferUpdate);
|
|
@@ -10295,7 +10411,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10295
10411
|
_createClass$4(Flv2, [{
|
|
10296
10412
|
key: "version",
|
|
10297
10413
|
get: function get() {
|
|
10298
|
-
return "3.0.
|
|
10414
|
+
return "3.0.17";
|
|
10299
10415
|
}
|
|
10300
10416
|
}, {
|
|
10301
10417
|
key: "isLive",
|
|
@@ -10469,10 +10585,10 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10469
10585
|
return this._clear();
|
|
10470
10586
|
case 10:
|
|
10471
10587
|
setTimeout(function() {
|
|
10472
|
-
_this3._loadData(url);
|
|
10473
|
-
_this3._bufferService.seamlessSwitch();
|
|
10474
10588
|
_this3._urlSwitching = true;
|
|
10475
10589
|
_this3._seamlessSwitching = true;
|
|
10590
|
+
_this3._loadData(url);
|
|
10591
|
+
_this3._bufferService.seamlessSwitch();
|
|
10476
10592
|
});
|
|
10477
10593
|
case 11:
|
|
10478
10594
|
case "end":
|
|
@@ -10502,16 +10618,17 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10502
10618
|
this.removeAllListeners();
|
|
10503
10619
|
this._seiService.reset();
|
|
10504
10620
|
this.media.removeEventListener("play", this._onPlay);
|
|
10621
|
+
this.media.removeEventListener("loadeddata", this._onLoadeddata);
|
|
10505
10622
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
10506
10623
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10507
10624
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10508
10625
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10509
|
-
_context7.next =
|
|
10626
|
+
_context7.next = 12;
|
|
10510
10627
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10511
|
-
case
|
|
10628
|
+
case 12:
|
|
10512
10629
|
this.media = null;
|
|
10513
10630
|
this._bufferService = null;
|
|
10514
|
-
case
|
|
10631
|
+
case 14:
|
|
10515
10632
|
case "end":
|
|
10516
10633
|
return _context7.stop();
|
|
10517
10634
|
}
|
|
@@ -10593,7 +10710,8 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10593
10710
|
}
|
|
10594
10711
|
this._mediaLoader.finnalUrl = finnalUrl;
|
|
10595
10712
|
this.emit(EVENT.LOAD_START, {
|
|
10596
|
-
url: finnalUrl
|
|
10713
|
+
url: finnalUrl,
|
|
10714
|
+
seamlessSwitching: this._seamlessSwitching
|
|
10597
10715
|
});
|
|
10598
10716
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10599
10717
|
if (!this._loading) {
|
|
@@ -10771,7 +10889,7 @@ var PluginExtension = /* @__PURE__ */ function() {
|
|
|
10771
10889
|
}();
|
|
10772
10890
|
var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
10773
10891
|
_inherits$3(FlvPlugin2, _BasePlugin);
|
|
10774
|
-
var _super = _createSuper$
|
|
10892
|
+
var _super = _createSuper$2(FlvPlugin2);
|
|
10775
10893
|
function FlvPlugin2() {
|
|
10776
10894
|
var _this;
|
|
10777
10895
|
_classCallCheck$4(this, FlvPlugin2);
|
|
@@ -10915,6 +11033,7 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
10915
11033
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
10916
11034
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
10917
11035
|
this._transCoreEvent(EVENT.KEYFRAME);
|
|
11036
|
+
this._transCoreEvent(EVENT.CHASEFRAME);
|
|
10918
11037
|
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
10919
11038
|
this._transCoreEvent(EVENT.SEI);
|
|
10920
11039
|
this._transCoreEvent(EVENT.SEI_IN_TIME);
|
|
@@ -10965,6 +11084,35 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
10965
11084
|
return FlvPlugin2;
|
|
10966
11085
|
}(BasePlugin);
|
|
10967
11086
|
_defineProperty$3(FlvPlugin, "Flv", Flv);
|
|
11087
|
+
function _callSuper(t, o, e) {
|
|
11088
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
11089
|
+
}
|
|
11090
|
+
function _isNativeReflectConstruct() {
|
|
11091
|
+
try {
|
|
11092
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
11093
|
+
}));
|
|
11094
|
+
} catch (t2) {
|
|
11095
|
+
}
|
|
11096
|
+
return (_isNativeReflectConstruct = function() {
|
|
11097
|
+
return !!t;
|
|
11098
|
+
})();
|
|
11099
|
+
}
|
|
11100
|
+
function _toPrimitive(t, r) {
|
|
11101
|
+
if ("object" != typeof t || !t)
|
|
11102
|
+
return t;
|
|
11103
|
+
var e = t[Symbol.toPrimitive];
|
|
11104
|
+
if (void 0 !== e) {
|
|
11105
|
+
var i = e.call(t, r || "default");
|
|
11106
|
+
if ("object" != typeof i)
|
|
11107
|
+
return i;
|
|
11108
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11109
|
+
}
|
|
11110
|
+
return ("string" === r ? String : Number)(t);
|
|
11111
|
+
}
|
|
11112
|
+
function _toPropertyKey(t) {
|
|
11113
|
+
var i = _toPrimitive(t, "string");
|
|
11114
|
+
return "symbol" == typeof i ? i : String(i);
|
|
11115
|
+
}
|
|
10968
11116
|
function _classCallCheck(instance, Constructor) {
|
|
10969
11117
|
if (!(instance instanceof Constructor)) {
|
|
10970
11118
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -11020,21 +11168,6 @@ function _setPrototypeOf(o, p) {
|
|
|
11020
11168
|
};
|
|
11021
11169
|
return _setPrototypeOf(o, p);
|
|
11022
11170
|
}
|
|
11023
|
-
function _isNativeReflectConstruct() {
|
|
11024
|
-
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
11025
|
-
return false;
|
|
11026
|
-
if (Reflect.construct.sham)
|
|
11027
|
-
return false;
|
|
11028
|
-
if (typeof Proxy === "function")
|
|
11029
|
-
return true;
|
|
11030
|
-
try {
|
|
11031
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
11032
|
-
}));
|
|
11033
|
-
return true;
|
|
11034
|
-
} catch (e) {
|
|
11035
|
-
return false;
|
|
11036
|
-
}
|
|
11037
|
-
}
|
|
11038
11171
|
function _assertThisInitialized(self) {
|
|
11039
11172
|
if (self === void 0) {
|
|
11040
11173
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -11049,41 +11182,11 @@ function _possibleConstructorReturn(self, call) {
|
|
|
11049
11182
|
}
|
|
11050
11183
|
return _assertThisInitialized(self);
|
|
11051
11184
|
}
|
|
11052
|
-
function _createSuper(Derived) {
|
|
11053
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
11054
|
-
return function _createSuperInternal() {
|
|
11055
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
11056
|
-
if (hasNativeReflectConstruct) {
|
|
11057
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
11058
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
11059
|
-
} else {
|
|
11060
|
-
result = Super.apply(this, arguments);
|
|
11061
|
-
}
|
|
11062
|
-
return _possibleConstructorReturn(this, result);
|
|
11063
|
-
};
|
|
11064
|
-
}
|
|
11065
|
-
function _toPrimitive(input, hint) {
|
|
11066
|
-
if (typeof input !== "object" || input === null)
|
|
11067
|
-
return input;
|
|
11068
|
-
var prim = input[Symbol.toPrimitive];
|
|
11069
|
-
if (prim !== void 0) {
|
|
11070
|
-
var res = prim.call(input, hint || "default");
|
|
11071
|
-
if (typeof res !== "object")
|
|
11072
|
-
return res;
|
|
11073
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11074
|
-
}
|
|
11075
|
-
return (hint === "string" ? String : Number)(input);
|
|
11076
|
-
}
|
|
11077
|
-
function _toPropertyKey(arg) {
|
|
11078
|
-
var key = _toPrimitive(arg, "string");
|
|
11079
|
-
return typeof key === "symbol" ? key : String(key);
|
|
11080
|
-
}
|
|
11081
11185
|
var Adaptive = /* @__PURE__ */ function(_BasePlugin) {
|
|
11082
11186
|
_inherits(Adaptive2, _BasePlugin);
|
|
11083
|
-
var _super = _createSuper(Adaptive2);
|
|
11084
11187
|
function Adaptive2() {
|
|
11085
11188
|
_classCallCheck(this, Adaptive2);
|
|
11086
|
-
return
|
|
11189
|
+
return _callSuper(this, Adaptive2, arguments);
|
|
11087
11190
|
}
|
|
11088
11191
|
_createClass(Adaptive2, [{
|
|
11089
11192
|
key: "afterCreate",
|