@volcengine/veplayer-plugin 2.3.0 → 2.4.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.d.ts +1 -0
- package/esm/index.development.js +4878 -1534
- package/esm/index.production.js +5 -5
- package/esm/veplayer.plugin.flv.development.js +352 -197
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +656 -261
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/package.json +21 -1
- package/umd/index.d.ts +1 -0
- package/umd/veplayer.plugin.flv.development.js +348 -193
- 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,13 +3067,72 @@
|
|
|
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() {
|
|
3111
|
+
var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3092
3112
|
try {
|
|
3093
|
-
|
|
3113
|
+
if (!isBrowser$1)
|
|
3114
|
+
return null;
|
|
3115
|
+
if (preferMMS && typeof ManagedMediaSource !== "undefined")
|
|
3116
|
+
return ManagedMediaSource;
|
|
3117
|
+
return window.MediaSource;
|
|
3094
3118
|
} catch (e) {
|
|
3095
3119
|
}
|
|
3096
3120
|
}
|
|
3097
|
-
|
|
3121
|
+
function isMMS(mediaSource) {
|
|
3122
|
+
return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
|
|
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
|
+
}
|
|
3098
3136
|
var OP_NAME = {
|
|
3099
3137
|
APPEND: "appendBuffer",
|
|
3100
3138
|
REMOVE: "removeBuffer",
|
|
@@ -3115,6 +3153,12 @@
|
|
|
3115
3153
|
_defineProperty$1(this, "_logger", null);
|
|
3116
3154
|
_defineProperty$1(this, "_config", null);
|
|
3117
3155
|
_defineProperty$1(this, "_url", null);
|
|
3156
|
+
_defineProperty$1(this, "_onStartStreaming", function() {
|
|
3157
|
+
_this2._logger.debug("startstreaming");
|
|
3158
|
+
});
|
|
3159
|
+
_defineProperty$1(this, "_onEndStreaming", function() {
|
|
3160
|
+
_this2._logger.debug("endstreaming");
|
|
3161
|
+
});
|
|
3118
3162
|
_defineProperty$1(this, "_onSBUpdateEnd", function(type) {
|
|
3119
3163
|
var queue = _this2._queue[type];
|
|
3120
3164
|
if (queue) {
|
|
@@ -3123,8 +3167,9 @@
|
|
|
3123
3167
|
queue.shift();
|
|
3124
3168
|
}
|
|
3125
3169
|
if (op) {
|
|
3126
|
-
var
|
|
3127
|
-
|
|
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);
|
|
3128
3173
|
op.promise.resolve({
|
|
3129
3174
|
name: op.opName,
|
|
3130
3175
|
context: op.context,
|
|
@@ -3158,6 +3203,19 @@
|
|
|
3158
3203
|
var _this$mediaSource;
|
|
3159
3204
|
return ((_this$mediaSource = this.mediaSource) === null || _this$mediaSource === void 0 ? void 0 : _this$mediaSource.readyState) === "open";
|
|
3160
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
|
+
}
|
|
3161
3219
|
}, {
|
|
3162
3220
|
key: "url",
|
|
3163
3221
|
get: function get() {
|
|
@@ -3174,6 +3232,11 @@
|
|
|
3174
3232
|
get: function get() {
|
|
3175
3233
|
return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
|
|
3176
3234
|
}
|
|
3235
|
+
}, {
|
|
3236
|
+
key: "streaming",
|
|
3237
|
+
get: function get() {
|
|
3238
|
+
return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
|
|
3239
|
+
}
|
|
3177
3240
|
}, {
|
|
3178
3241
|
key: "isFull",
|
|
3179
3242
|
value: function isFull(type) {
|
|
@@ -3182,13 +3245,13 @@
|
|
|
3182
3245
|
}, {
|
|
3183
3246
|
key: "updateDuration",
|
|
3184
3247
|
value: function updateDuration(duration) {
|
|
3185
|
-
var
|
|
3248
|
+
var _this4 = this;
|
|
3186
3249
|
var isReduceDuration = this.mediaSource && this.mediaSource.duration > duration;
|
|
3187
3250
|
if (this.mediaSource && this.mediaSource.duration > duration) {
|
|
3188
3251
|
var bufferEnd = 0;
|
|
3189
3252
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3190
3253
|
try {
|
|
3191
|
-
bufferEnd = Math.max(
|
|
3254
|
+
bufferEnd = Math.max(_this4.bufferEnd(k) || 0, bufferEnd);
|
|
3192
3255
|
} catch (error) {
|
|
3193
3256
|
}
|
|
3194
3257
|
});
|
|
@@ -3197,13 +3260,13 @@
|
|
|
3197
3260
|
}
|
|
3198
3261
|
}
|
|
3199
3262
|
return this._enqueueBlockingOp(function() {
|
|
3200
|
-
if (
|
|
3201
|
-
|
|
3263
|
+
if (_this4.isEnded) {
|
|
3264
|
+
_this4._logger.debug("setDuration but ended");
|
|
3202
3265
|
return;
|
|
3203
3266
|
}
|
|
3204
|
-
if (
|
|
3205
|
-
|
|
3206
|
-
|
|
3267
|
+
if (_this4.mediaSource) {
|
|
3268
|
+
_this4.mediaSource.duration = duration;
|
|
3269
|
+
_this4._logger.debug("setDuration", duration);
|
|
3207
3270
|
}
|
|
3208
3271
|
}, OP_NAME.UPDATE_DURATION, {
|
|
3209
3272
|
isReduceDuration
|
|
@@ -3212,15 +3275,15 @@
|
|
|
3212
3275
|
}, {
|
|
3213
3276
|
key: "open",
|
|
3214
3277
|
value: function open() {
|
|
3215
|
-
var
|
|
3278
|
+
var _this5 = this;
|
|
3216
3279
|
if (this._openPromise.used && !this.isOpened && this.mediaSource) {
|
|
3217
3280
|
var ms = this.mediaSource;
|
|
3218
3281
|
var onOpen = function onOpen2() {
|
|
3219
|
-
var
|
|
3220
|
-
|
|
3282
|
+
var costTime = nowTime() - _this5._st;
|
|
3283
|
+
_this5._logger.debug("sourceopen", costTime);
|
|
3221
3284
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3222
|
-
|
|
3223
|
-
costtime
|
|
3285
|
+
_this5._openPromise.resolve({
|
|
3286
|
+
costtime: costTime
|
|
3224
3287
|
});
|
|
3225
3288
|
};
|
|
3226
3289
|
ms.addEventListener("sourceopen", onOpen);
|
|
@@ -3232,8 +3295,8 @@
|
|
|
3232
3295
|
key: "bindMedia",
|
|
3233
3296
|
value: function() {
|
|
3234
3297
|
var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
|
|
3235
|
-
var
|
|
3236
|
-
var ms, onOpen;
|
|
3298
|
+
var _this6 = this;
|
|
3299
|
+
var MediaSource2, ms, useMMS, onOpen;
|
|
3237
3300
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3238
3301
|
while (1)
|
|
3239
3302
|
switch (_context.prev = _context.next) {
|
|
@@ -3245,29 +3308,36 @@
|
|
|
3245
3308
|
_context.next = 3;
|
|
3246
3309
|
return this.unbindMedia();
|
|
3247
3310
|
case 3:
|
|
3248
|
-
|
|
3249
|
-
|
|
3311
|
+
MediaSource2 = getMediaSource(this._config.preferMMS);
|
|
3312
|
+
if (!(!media || !MediaSource2)) {
|
|
3313
|
+
_context.next = 6;
|
|
3250
3314
|
break;
|
|
3251
3315
|
}
|
|
3252
3316
|
throw new Error("Param media or MediaSource does not exist");
|
|
3253
|
-
case
|
|
3317
|
+
case 6:
|
|
3254
3318
|
this.media = media;
|
|
3255
|
-
ms = this.mediaSource = new
|
|
3256
|
-
|
|
3319
|
+
ms = this.mediaSource = new MediaSource2();
|
|
3320
|
+
useMMS = isMMS(ms);
|
|
3321
|
+
this._st = nowTime();
|
|
3257
3322
|
onOpen = function onOpen2() {
|
|
3258
|
-
var
|
|
3259
|
-
|
|
3323
|
+
var costTime = nowTime() - _this6._st;
|
|
3324
|
+
_this6._logger.debug("sourceopen");
|
|
3260
3325
|
ms.removeEventListener("sourceopen", onOpen2);
|
|
3261
3326
|
URL.revokeObjectURL(media.src);
|
|
3262
|
-
|
|
3263
|
-
costtime
|
|
3327
|
+
_this6._openPromise.resolve({
|
|
3328
|
+
costtime: costTime
|
|
3264
3329
|
});
|
|
3265
3330
|
};
|
|
3266
3331
|
ms.addEventListener("sourceopen", onOpen);
|
|
3332
|
+
if (useMMS) {
|
|
3333
|
+
ms.addEventListener("startstreaming", this._onStartStreaming);
|
|
3334
|
+
ms.addEventListener("endstreaming", this._onEndStreaming);
|
|
3335
|
+
}
|
|
3267
3336
|
this._url = URL.createObjectURL(ms);
|
|
3268
3337
|
media.src = this._url;
|
|
3338
|
+
media.disableRemotePlayback = useMMS;
|
|
3269
3339
|
return _context.abrupt("return", this._openPromise);
|
|
3270
|
-
case
|
|
3340
|
+
case 17:
|
|
3271
3341
|
case "end":
|
|
3272
3342
|
return _context.stop();
|
|
3273
3343
|
}
|
|
@@ -3282,7 +3352,7 @@
|
|
|
3282
3352
|
key: "unbindMedia",
|
|
3283
3353
|
value: function() {
|
|
3284
3354
|
var _unbindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
|
|
3285
|
-
var
|
|
3355
|
+
var _this7 = this;
|
|
3286
3356
|
var ms, hasMetadata, mseOpen;
|
|
3287
3357
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3288
3358
|
while (1)
|
|
@@ -3293,7 +3363,7 @@
|
|
|
3293
3363
|
ms = this.mediaSource;
|
|
3294
3364
|
if (ms) {
|
|
3295
3365
|
Object.keys(this._queue).forEach(function(t) {
|
|
3296
|
-
var queue =
|
|
3366
|
+
var queue = _this7._queue[t];
|
|
3297
3367
|
if (queue) {
|
|
3298
3368
|
queue.forEach(function(x) {
|
|
3299
3369
|
var _x$promise, _x$promise$resolve;
|
|
@@ -3311,12 +3381,17 @@
|
|
|
3311
3381
|
}
|
|
3312
3382
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3313
3383
|
try {
|
|
3314
|
-
ms.removeSourceBuffer(
|
|
3384
|
+
ms.removeSourceBuffer(_this7._sourceBuffer[k]);
|
|
3315
3385
|
} catch (error) {
|
|
3316
3386
|
}
|
|
3317
3387
|
});
|
|
3388
|
+
if (isMMS(ms)) {
|
|
3389
|
+
ms.removeEventListener("startstreaming", this._onStartStreaming);
|
|
3390
|
+
ms.removeEventListener("endstreaming", this._onEndStreaming);
|
|
3391
|
+
}
|
|
3318
3392
|
}
|
|
3319
3393
|
if (this.media) {
|
|
3394
|
+
this.media.disableRemotePlayback = false;
|
|
3320
3395
|
this.media.removeAttribute("src");
|
|
3321
3396
|
try {
|
|
3322
3397
|
this.media.load();
|
|
@@ -3357,7 +3432,7 @@
|
|
|
3357
3432
|
}, {
|
|
3358
3433
|
key: "changeType",
|
|
3359
3434
|
value: function changeType(type, mimeType) {
|
|
3360
|
-
var
|
|
3435
|
+
var _this8 = this;
|
|
3361
3436
|
var sb = this._sourceBuffer[type];
|
|
3362
3437
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3363
3438
|
return Promise.resolve();
|
|
@@ -3366,7 +3441,7 @@
|
|
|
3366
3441
|
return this._enqueueOp(type, function() {
|
|
3367
3442
|
sb.changeType(mimeType);
|
|
3368
3443
|
sb.mimeType = mimeType;
|
|
3369
|
-
|
|
3444
|
+
_this8._onSBUpdateEnd(type);
|
|
3370
3445
|
}, "changeType", {
|
|
3371
3446
|
mimeType
|
|
3372
3447
|
});
|
|
@@ -3380,60 +3455,60 @@
|
|
|
3380
3455
|
}, {
|
|
3381
3456
|
key: "append",
|
|
3382
3457
|
value: function append(type, buffer, context) {
|
|
3383
|
-
var
|
|
3458
|
+
var _this9 = this;
|
|
3384
3459
|
if (!buffer || !buffer.byteLength) {
|
|
3385
3460
|
return Promise.resolve();
|
|
3386
3461
|
}
|
|
3387
3462
|
if (!this._sourceBuffer[type])
|
|
3388
3463
|
return Promise.resolve();
|
|
3389
3464
|
return this._enqueueOp(type, function() {
|
|
3390
|
-
var
|
|
3391
|
-
if (!
|
|
3465
|
+
var _this9$_sourceBuffer$;
|
|
3466
|
+
if (!_this9.mediaSource || _this9.media.error)
|
|
3392
3467
|
return;
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
(
|
|
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);
|
|
3396
3471
|
}, OP_NAME.APPEND, context);
|
|
3397
3472
|
}
|
|
3398
3473
|
}, {
|
|
3399
3474
|
key: "remove",
|
|
3400
3475
|
value: function remove(type, startTime, endTime, context) {
|
|
3401
|
-
var
|
|
3476
|
+
var _this10 = this;
|
|
3402
3477
|
var isInsertHead = false;
|
|
3403
3478
|
if (this._mseFullFlag[type]) {
|
|
3404
3479
|
isInsertHead = true;
|
|
3405
3480
|
}
|
|
3406
3481
|
return this._enqueueOp(type, function() {
|
|
3407
|
-
if (!
|
|
3482
|
+
if (!_this10.mediaSource || _this10.media.error)
|
|
3408
3483
|
return;
|
|
3409
|
-
var sb =
|
|
3484
|
+
var sb = _this10._sourceBuffer[type];
|
|
3410
3485
|
if (startTime >= endTime || !sb) {
|
|
3411
|
-
|
|
3486
|
+
_this10._onSBUpdateEnd(type);
|
|
3412
3487
|
return;
|
|
3413
3488
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3489
|
+
_this10._opst = nowTime();
|
|
3490
|
+
_this10._logger.debug("MSE REMOVE START", type, startTime, endTime, context);
|
|
3416
3491
|
sb.remove(startTime, endTime);
|
|
3417
3492
|
}, OP_NAME.REMOVE, context, isInsertHead);
|
|
3418
3493
|
}
|
|
3419
3494
|
}, {
|
|
3420
3495
|
key: "clearBuffer",
|
|
3421
3496
|
value: function clearBuffer(startTime, endTime) {
|
|
3422
|
-
var
|
|
3497
|
+
var _this11 = this;
|
|
3423
3498
|
var p;
|
|
3424
3499
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3425
|
-
p =
|
|
3500
|
+
p = _this11.remove(k, startTime, endTime);
|
|
3426
3501
|
});
|
|
3427
3502
|
return p || Promise.resolve();
|
|
3428
3503
|
}
|
|
3429
3504
|
}, {
|
|
3430
3505
|
key: "clearAllBuffer",
|
|
3431
3506
|
value: function clearAllBuffer() {
|
|
3432
|
-
var
|
|
3507
|
+
var _this12 = this;
|
|
3433
3508
|
var p;
|
|
3434
3509
|
Object.keys(this._sourceBuffer).forEach(function(k) {
|
|
3435
|
-
var sb =
|
|
3436
|
-
p =
|
|
3510
|
+
var sb = _this12._sourceBuffer[k];
|
|
3511
|
+
p = _this12.remove(k, 0, Buffer$1.end(Buffer$1.get(sb)));
|
|
3437
3512
|
});
|
|
3438
3513
|
return p;
|
|
3439
3514
|
}
|
|
@@ -3449,26 +3524,26 @@
|
|
|
3449
3524
|
}
|
|
3450
3525
|
if (!queue || !queue[type] || queue.length < 5)
|
|
3451
3526
|
return;
|
|
3452
|
-
var
|
|
3527
|
+
var initQueue = [];
|
|
3453
3528
|
queue.forEach(function(op) {
|
|
3454
3529
|
if (op.context && op.context.isinit) {
|
|
3455
|
-
|
|
3530
|
+
initQueue.push(op);
|
|
3456
3531
|
}
|
|
3457
3532
|
});
|
|
3458
3533
|
this._queue[type] = queue.slice(0, 2);
|
|
3459
|
-
|
|
3534
|
+
initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
|
|
3460
3535
|
}
|
|
3461
3536
|
}, {
|
|
3462
3537
|
key: "endOfStream",
|
|
3463
3538
|
value: function endOfStream(reason) {
|
|
3464
|
-
var
|
|
3539
|
+
var _this13 = this;
|
|
3465
3540
|
if (!this.mediaSource || this.mediaSource.readyState !== "open")
|
|
3466
3541
|
return Promise.resolve();
|
|
3467
3542
|
return this._enqueueBlockingOp(function() {
|
|
3468
|
-
var ms =
|
|
3543
|
+
var ms = _this13.mediaSource;
|
|
3469
3544
|
if (!ms || ms.readyState !== "open")
|
|
3470
3545
|
return;
|
|
3471
|
-
|
|
3546
|
+
_this13._logger.debug("MSE endOfStream START");
|
|
3472
3547
|
if (reason) {
|
|
3473
3548
|
ms.endOfStream(reason);
|
|
3474
3549
|
} else {
|
|
@@ -3507,7 +3582,7 @@
|
|
|
3507
3582
|
}, {
|
|
3508
3583
|
key: "_enqueueOp",
|
|
3509
3584
|
value: function _enqueueOp(type, exec, opName, context, isInsertHead) {
|
|
3510
|
-
var
|
|
3585
|
+
var _this14 = this;
|
|
3511
3586
|
if (!this.mediaSource)
|
|
3512
3587
|
return Promise.resolve();
|
|
3513
3588
|
var queue = this._queue[type] = this._queue[type] || [];
|
|
@@ -3531,7 +3606,7 @@
|
|
|
3531
3606
|
} else {
|
|
3532
3607
|
this._openPromise.then(function() {
|
|
3533
3608
|
if (queue.length === 1) {
|
|
3534
|
-
|
|
3609
|
+
_this14._startQueue(type);
|
|
3535
3610
|
}
|
|
3536
3611
|
});
|
|
3537
3612
|
}
|
|
@@ -3541,7 +3616,7 @@
|
|
|
3541
3616
|
key: "_enqueueBlockingOp",
|
|
3542
3617
|
value: function() {
|
|
3543
3618
|
var _enqueueBlockingOp2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(exec, opName, context) {
|
|
3544
|
-
var
|
|
3619
|
+
var _this15 = this;
|
|
3545
3620
|
var types, waiters;
|
|
3546
3621
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3547
3622
|
while (1)
|
|
@@ -3562,7 +3637,7 @@
|
|
|
3562
3637
|
case 5:
|
|
3563
3638
|
waiters = [];
|
|
3564
3639
|
types.forEach(function(t) {
|
|
3565
|
-
var queue =
|
|
3640
|
+
var queue = _this15._queue[t];
|
|
3566
3641
|
var prom = createPublicPromise();
|
|
3567
3642
|
waiters.push(prom);
|
|
3568
3643
|
queue.push({
|
|
@@ -3574,7 +3649,7 @@
|
|
|
3574
3649
|
context
|
|
3575
3650
|
});
|
|
3576
3651
|
if (queue.length === 1) {
|
|
3577
|
-
|
|
3652
|
+
_this15._startQueue(t);
|
|
3578
3653
|
}
|
|
3579
3654
|
});
|
|
3580
3655
|
return _context3.abrupt("return", Promise.all(waiters).then(function() {
|
|
@@ -3582,11 +3657,11 @@
|
|
|
3582
3657
|
return exec();
|
|
3583
3658
|
} finally {
|
|
3584
3659
|
types.forEach(function(t) {
|
|
3585
|
-
var queue =
|
|
3586
|
-
var sb =
|
|
3660
|
+
var queue = _this15._queue[t];
|
|
3661
|
+
var sb = _this15._sourceBuffer[t];
|
|
3587
3662
|
queue === null || queue === void 0 ? void 0 : queue.shift();
|
|
3588
3663
|
if (!sb || !sb.updating) {
|
|
3589
|
-
|
|
3664
|
+
_this15._startQueue(t);
|
|
3590
3665
|
}
|
|
3591
3666
|
});
|
|
3592
3667
|
}
|
|
@@ -3629,47 +3704,54 @@
|
|
|
3629
3704
|
}, {
|
|
3630
3705
|
key: "setTimeoffset",
|
|
3631
3706
|
value: function setTimeoffset(type, timestampOffset, context) {
|
|
3632
|
-
var
|
|
3707
|
+
var _this16 = this;
|
|
3633
3708
|
return this._enqueueOp(type, function() {
|
|
3634
3709
|
if (timestampOffset < 0) {
|
|
3635
3710
|
timestampOffset += 1e-3;
|
|
3636
3711
|
}
|
|
3637
|
-
|
|
3638
|
-
|
|
3712
|
+
_this16._sourceBuffer[type].timestampOffset = timestampOffset;
|
|
3713
|
+
_this16._onSBUpdateEnd(type);
|
|
3639
3714
|
}, "setTimeoffset", context);
|
|
3640
3715
|
}
|
|
3641
3716
|
}, {
|
|
3642
3717
|
key: "abort",
|
|
3643
3718
|
value: function abort(type, context) {
|
|
3644
|
-
var
|
|
3719
|
+
var _this17 = this;
|
|
3645
3720
|
if (!this.isOpened) {
|
|
3646
3721
|
return Promise.resolve();
|
|
3647
3722
|
}
|
|
3648
3723
|
return this._enqueueOp(type, function() {
|
|
3649
|
-
|
|
3650
|
-
|
|
3724
|
+
_this17._sourceBuffer[type].abort();
|
|
3725
|
+
_this17._onSBUpdateEnd(type);
|
|
3651
3726
|
}, "abort", context);
|
|
3652
3727
|
}
|
|
3653
3728
|
}], [{
|
|
3654
|
-
key: "getDefaultConfig",
|
|
3655
|
-
value: function getDefaultConfig() {
|
|
3656
|
-
return {
|
|
3657
|
-
openLog: false
|
|
3658
|
-
};
|
|
3659
|
-
}
|
|
3660
|
-
}, {
|
|
3661
3729
|
key: "isSupported",
|
|
3662
3730
|
value: function isSupported() {
|
|
3663
3731
|
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3664
|
-
|
|
3732
|
+
var MediaSource2 = getMediaSource();
|
|
3733
|
+
if (!MediaSource2)
|
|
3665
3734
|
return false;
|
|
3666
3735
|
try {
|
|
3667
|
-
return
|
|
3736
|
+
return MediaSource2.isTypeSupported(mime);
|
|
3668
3737
|
} catch (error) {
|
|
3669
3738
|
this._logger.error(mime, error);
|
|
3670
3739
|
return false;
|
|
3671
3740
|
}
|
|
3672
3741
|
}
|
|
3742
|
+
}, {
|
|
3743
|
+
key: "isMMSOnly",
|
|
3744
|
+
value: function isMMSOnly() {
|
|
3745
|
+
return typeof ManagedMediaSource !== "undefined" && typeof MediaSource === "undefined";
|
|
3746
|
+
}
|
|
3747
|
+
}, {
|
|
3748
|
+
key: "getDefaultConfig",
|
|
3749
|
+
value: function getDefaultConfig() {
|
|
3750
|
+
return {
|
|
3751
|
+
openLog: false,
|
|
3752
|
+
preferMMS: false
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3673
3755
|
}]);
|
|
3674
3756
|
return MSE2;
|
|
3675
3757
|
}();
|
|
@@ -3686,7 +3768,7 @@
|
|
|
3686
3768
|
};
|
|
3687
3769
|
var NetError = /* @__PURE__ */ function(_Error) {
|
|
3688
3770
|
_inherits$2(NetError2, _Error);
|
|
3689
|
-
var _super = _createSuper$
|
|
3771
|
+
var _super = _createSuper$1(NetError2);
|
|
3690
3772
|
function NetError2(url, request, response, msg) {
|
|
3691
3773
|
var _this;
|
|
3692
3774
|
_classCallCheck$2(this, NetError2);
|
|
@@ -3797,10 +3879,12 @@
|
|
|
3797
3879
|
LOAD_COMPLETE: "core.loadcomplete",
|
|
3798
3880
|
LOAD_RETRY: "core.loadretry",
|
|
3799
3881
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3882
|
+
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3800
3883
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3801
3884
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3802
3885
|
BUFFEREOS: "core.buffereos",
|
|
3803
3886
|
KEYFRAME: "core.keyframe",
|
|
3887
|
+
CHASEFRAME: "core.chaseframe",
|
|
3804
3888
|
METADATA_PARSED: "core.metadataparsed",
|
|
3805
3889
|
SEI: "core.sei",
|
|
3806
3890
|
SEI_IN_TIME: "core.seiintime",
|
|
@@ -3824,7 +3908,7 @@
|
|
|
3824
3908
|
var CACHESIZE = 2 * 1024 * 1024;
|
|
3825
3909
|
var FetchLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
3826
3910
|
_inherits$2(FetchLoader2, _EventEmitter);
|
|
3827
|
-
var _super = _createSuper$
|
|
3911
|
+
var _super = _createSuper$1(FetchLoader2);
|
|
3828
3912
|
function FetchLoader2() {
|
|
3829
3913
|
var _this;
|
|
3830
3914
|
_classCallCheck$2(this, FetchLoader2);
|
|
@@ -4276,7 +4360,7 @@
|
|
|
4276
4360
|
}
|
|
4277
4361
|
var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4278
4362
|
_inherits$2(XhrLoader2, _EventEmitter);
|
|
4279
|
-
var _super = _createSuper$
|
|
4363
|
+
var _super = _createSuper$1(XhrLoader2);
|
|
4280
4364
|
function XhrLoader2() {
|
|
4281
4365
|
var _this;
|
|
4282
4366
|
_classCallCheck$2(this, XhrLoader2);
|
|
@@ -4760,7 +4844,7 @@
|
|
|
4760
4844
|
}
|
|
4761
4845
|
var NetLoader = /* @__PURE__ */ function(_EventEmitter) {
|
|
4762
4846
|
_inherits$2(NetLoader2, _EventEmitter);
|
|
4763
|
-
var _super = _createSuper$
|
|
4847
|
+
var _super = _createSuper$1(NetLoader2);
|
|
4764
4848
|
function NetLoader2(cfg) {
|
|
4765
4849
|
var _this;
|
|
4766
4850
|
_classCallCheck$2(this, NetLoader2);
|
|
@@ -5303,7 +5387,7 @@
|
|
|
5303
5387
|
}
|
|
5304
5388
|
return _assertThisInitialized$1(self2);
|
|
5305
5389
|
}
|
|
5306
|
-
function _createSuper
|
|
5390
|
+
function _createSuper(Derived) {
|
|
5307
5391
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
5308
5392
|
return function _createSuperInternal() {
|
|
5309
5393
|
var Super = _getPrototypeOf$1(Derived), result;
|
|
@@ -5447,6 +5531,26 @@
|
|
|
5447
5531
|
this.warnings = [];
|
|
5448
5532
|
this.hvcC = null;
|
|
5449
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
|
+
}
|
|
5450
5554
|
}, {
|
|
5451
5555
|
key: "exist",
|
|
5452
5556
|
value: function exist() {
|
|
@@ -5525,6 +5629,26 @@
|
|
|
5525
5629
|
get: function get() {
|
|
5526
5630
|
return this.isAudioEncryption;
|
|
5527
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
|
+
}
|
|
5528
5652
|
}]);
|
|
5529
5653
|
return AudioTrack2;
|
|
5530
5654
|
}();
|
|
@@ -5585,7 +5709,7 @@
|
|
|
5585
5709
|
);
|
|
5586
5710
|
var FlvScriptSample = /* @__PURE__ */ function(_Sample) {
|
|
5587
5711
|
_inherits$1(FlvScriptSample2, _Sample);
|
|
5588
|
-
var _super = _createSuper
|
|
5712
|
+
var _super = _createSuper(FlvScriptSample2);
|
|
5589
5713
|
function FlvScriptSample2() {
|
|
5590
5714
|
_classCallCheck$1(this, FlvScriptSample2);
|
|
5591
5715
|
return _super.apply(this, arguments);
|
|
@@ -5594,7 +5718,7 @@
|
|
|
5594
5718
|
}(Sample);
|
|
5595
5719
|
var SeiSample = /* @__PURE__ */ function(_Sample2) {
|
|
5596
5720
|
_inherits$1(SeiSample2, _Sample2);
|
|
5597
|
-
var _super2 = _createSuper
|
|
5721
|
+
var _super2 = _createSuper(SeiSample2);
|
|
5598
5722
|
function SeiSample2() {
|
|
5599
5723
|
_classCallCheck$1(this, SeiSample2);
|
|
5600
5724
|
return _super2.apply(this, arguments);
|
|
@@ -9392,7 +9516,8 @@
|
|
|
9392
9516
|
}();
|
|
9393
9517
|
var logger$1 = new Logger$2("BufferService");
|
|
9394
9518
|
var BufferService = /* @__PURE__ */ function() {
|
|
9395
|
-
function BufferService2(flv, softVideo
|
|
9519
|
+
function BufferService2(flv, softVideo) {
|
|
9520
|
+
var opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
9396
9521
|
_classCallCheck$4(this, BufferService2);
|
|
9397
9522
|
_defineProperty$3(this, "flv", null);
|
|
9398
9523
|
_defineProperty$3(this, "_demuxer", new FlvDemuxer());
|
|
@@ -9413,7 +9538,9 @@
|
|
|
9413
9538
|
this._softVideo = softVideo;
|
|
9414
9539
|
} else {
|
|
9415
9540
|
this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack);
|
|
9416
|
-
this._mse = new MSE(
|
|
9541
|
+
this._mse = new MSE(null, {
|
|
9542
|
+
preferMMS: typeof opts.preferMMS === "boolean" ? opts.preferMMS : !!opts.perferMMS
|
|
9543
|
+
});
|
|
9417
9544
|
this._mse.bindMedia(flv.media);
|
|
9418
9545
|
}
|
|
9419
9546
|
}
|
|
@@ -9423,6 +9550,12 @@
|
|
|
9423
9550
|
var _this$_demuxer, _this$_demuxer$_fixer;
|
|
9424
9551
|
return (_this$_demuxer = this._demuxer) === null || _this$_demuxer === void 0 ? void 0 : (_this$_demuxer$_fixer = _this$_demuxer._fixer) === null || _this$_demuxer$_fixer === void 0 ? void 0 : _this$_demuxer$_fixer._baseDts;
|
|
9425
9552
|
}
|
|
9553
|
+
}, {
|
|
9554
|
+
key: "blobUrl",
|
|
9555
|
+
get: function get() {
|
|
9556
|
+
var _this$_mse;
|
|
9557
|
+
return (_this$_mse = this._mse) === null || _this$_mse === void 0 ? void 0 : _this$_mse.url;
|
|
9558
|
+
}
|
|
9426
9559
|
}, {
|
|
9427
9560
|
key: "isFull",
|
|
9428
9561
|
value: function isFull() {
|
|
@@ -9662,7 +9795,7 @@
|
|
|
9662
9795
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9663
9796
|
}
|
|
9664
9797
|
if (!mse) {
|
|
9665
|
-
_context5.next =
|
|
9798
|
+
_context5.next = 66;
|
|
9666
9799
|
break;
|
|
9667
9800
|
}
|
|
9668
9801
|
if (this._sourceCreated) {
|
|
@@ -9684,20 +9817,24 @@
|
|
|
9684
9817
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9685
9818
|
case 47:
|
|
9686
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
|
+
}
|
|
9687
9824
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9688
|
-
_context5.next =
|
|
9825
|
+
_context5.next = 55;
|
|
9689
9826
|
break;
|
|
9690
|
-
case
|
|
9691
|
-
_context5.prev =
|
|
9827
|
+
case 52:
|
|
9828
|
+
_context5.prev = 52;
|
|
9692
9829
|
_context5.t1 = _context5["catch"](47);
|
|
9693
9830
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9694
|
-
case
|
|
9831
|
+
case 55:
|
|
9695
9832
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9696
|
-
_context5.next =
|
|
9833
|
+
_context5.next = 57;
|
|
9697
9834
|
break;
|
|
9698
9835
|
}
|
|
9699
9836
|
return _context5.abrupt("return");
|
|
9700
|
-
case
|
|
9837
|
+
case 57:
|
|
9701
9838
|
this._needInitSegment = false;
|
|
9702
9839
|
p = [];
|
|
9703
9840
|
if (remuxResult.videoInitSegment)
|
|
@@ -9709,15 +9846,15 @@
|
|
|
9709
9846
|
if (remuxResult.audioSegment)
|
|
9710
9847
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9711
9848
|
return _context5.abrupt("return", Promise.all(p));
|
|
9712
|
-
case
|
|
9849
|
+
case 66:
|
|
9713
9850
|
if (this._softVideo) {
|
|
9714
9851
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
9715
9852
|
}
|
|
9716
|
-
case
|
|
9853
|
+
case 67:
|
|
9717
9854
|
case "end":
|
|
9718
9855
|
return _context5.stop();
|
|
9719
9856
|
}
|
|
9720
|
-
}, _callee5, this, [[4, 8], [47,
|
|
9857
|
+
}, _callee5, this, [[4, 8], [47, 52]]);
|
|
9721
9858
|
}));
|
|
9722
9859
|
function appendBuffer(_x2) {
|
|
9723
9860
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9888,7 +10025,10 @@
|
|
|
9888
10025
|
seamlesslyReload: false,
|
|
9889
10026
|
keepStatusAfterSwitch: true,
|
|
9890
10027
|
onlyVideo: false,
|
|
9891
|
-
onlyAudio: false
|
|
10028
|
+
onlyAudio: false,
|
|
10029
|
+
preferMMS: false,
|
|
10030
|
+
mseLowLatency: true,
|
|
10031
|
+
durationForMSELowLatencyOff: 6
|
|
9892
10032
|
}, opts);
|
|
9893
10033
|
if (ret.isLive) {
|
|
9894
10034
|
if (ret.preloadTime) {
|
|
@@ -9930,9 +10070,10 @@
|
|
|
9930
10070
|
}
|
|
9931
10071
|
var logger = new Logger$2("flv");
|
|
9932
10072
|
var MAX_HOLE = 0.1;
|
|
10073
|
+
var MAX_START_GAP = 0.3;
|
|
9933
10074
|
var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
9934
10075
|
_inherits$3(Flv2, _EventEmitter);
|
|
9935
|
-
var _super = _createSuper$
|
|
10076
|
+
var _super = _createSuper$2(Flv2);
|
|
9936
10077
|
function Flv2(_opts) {
|
|
9937
10078
|
var _this;
|
|
9938
10079
|
_classCallCheck$4(this, Flv2);
|
|
@@ -10100,10 +10241,13 @@
|
|
|
10100
10241
|
}
|
|
10101
10242
|
} else {
|
|
10102
10243
|
if (!media.currentTime && _this._gapService) {
|
|
10103
|
-
_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
|
+
}
|
|
10104
10248
|
return;
|
|
10105
10249
|
}
|
|
10106
|
-
if (opts.isLive && bufferEnd > opts.disconnectTime) {
|
|
10250
|
+
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
10107
10251
|
_this.disconnect();
|
|
10108
10252
|
}
|
|
10109
10253
|
}
|
|
@@ -10122,6 +10266,14 @@
|
|
|
10122
10266
|
_this._tick();
|
|
10123
10267
|
}
|
|
10124
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
|
+
});
|
|
10125
10277
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onSeeking", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
10126
10278
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10127
10279
|
while (1)
|
|
@@ -10147,6 +10299,10 @@
|
|
|
10147
10299
|
var latency = bufferEnd - currentTime;
|
|
10148
10300
|
if (latency >= opts.maxLatency) {
|
|
10149
10301
|
_this.media.currentTime = bufferEnd - opts.targetLatency;
|
|
10302
|
+
_this.emit(EVENT.CHASEFRAME, {
|
|
10303
|
+
currentTime: _this.media.currentTime,
|
|
10304
|
+
latency: opts.targetLatency
|
|
10305
|
+
});
|
|
10150
10306
|
}
|
|
10151
10307
|
}
|
|
10152
10308
|
_this._seiService.throw(currentTime, true);
|
|
@@ -10248,6 +10404,7 @@
|
|
|
10248
10404
|
_this._gapService = new GapService();
|
|
10249
10405
|
}
|
|
10250
10406
|
_this.media.addEventListener("play", _this._onPlay);
|
|
10407
|
+
_this.media.addEventListener("loadeddata", _this._onLoadeddata);
|
|
10251
10408
|
_this.media.addEventListener("seeking", _this._onSeeking);
|
|
10252
10409
|
_this.media.addEventListener("timeupdate", _this._onTimeupdate);
|
|
10253
10410
|
_this.media.addEventListener("progress", _this._onBufferUpdate);
|
|
@@ -10258,7 +10415,7 @@
|
|
|
10258
10415
|
_createClass$4(Flv2, [{
|
|
10259
10416
|
key: "version",
|
|
10260
10417
|
get: function get() {
|
|
10261
|
-
return "3.0.
|
|
10418
|
+
return "3.0.17";
|
|
10262
10419
|
}
|
|
10263
10420
|
}, {
|
|
10264
10421
|
key: "isLive",
|
|
@@ -10281,6 +10438,12 @@
|
|
|
10281
10438
|
get: function get() {
|
|
10282
10439
|
return this._mediaLoader;
|
|
10283
10440
|
}
|
|
10441
|
+
}, {
|
|
10442
|
+
key: "blobUrl",
|
|
10443
|
+
get: function get() {
|
|
10444
|
+
var _this$_bufferService3;
|
|
10445
|
+
return (_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.blobUrl;
|
|
10446
|
+
}
|
|
10284
10447
|
}, {
|
|
10285
10448
|
key: "speedInfo",
|
|
10286
10449
|
value: function speedInfo() {
|
|
@@ -10426,10 +10589,10 @@
|
|
|
10426
10589
|
return this._clear();
|
|
10427
10590
|
case 10:
|
|
10428
10591
|
setTimeout(function() {
|
|
10429
|
-
_this3._loadData(url);
|
|
10430
|
-
_this3._bufferService.seamlessSwitch();
|
|
10431
10592
|
_this3._urlSwitching = true;
|
|
10432
10593
|
_this3._seamlessSwitching = true;
|
|
10594
|
+
_this3._loadData(url);
|
|
10595
|
+
_this3._bufferService.seamlessSwitch();
|
|
10433
10596
|
});
|
|
10434
10597
|
case 11:
|
|
10435
10598
|
case "end":
|
|
@@ -10459,16 +10622,17 @@
|
|
|
10459
10622
|
this.removeAllListeners();
|
|
10460
10623
|
this._seiService.reset();
|
|
10461
10624
|
this.media.removeEventListener("play", this._onPlay);
|
|
10625
|
+
this.media.removeEventListener("loadeddata", this._onLoadeddata);
|
|
10462
10626
|
this.media.removeEventListener("seeking", this._onSeeking);
|
|
10463
10627
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10464
10628
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10465
10629
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10466
|
-
_context7.next =
|
|
10630
|
+
_context7.next = 12;
|
|
10467
10631
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10468
|
-
case
|
|
10632
|
+
case 12:
|
|
10469
10633
|
this.media = null;
|
|
10470
10634
|
this._bufferService = null;
|
|
10471
|
-
case
|
|
10635
|
+
case 14:
|
|
10472
10636
|
case "end":
|
|
10473
10637
|
return _context7.stop();
|
|
10474
10638
|
}
|
|
@@ -10550,7 +10714,8 @@
|
|
|
10550
10714
|
}
|
|
10551
10715
|
this._mediaLoader.finnalUrl = finnalUrl;
|
|
10552
10716
|
this.emit(EVENT.LOAD_START, {
|
|
10553
|
-
url: finnalUrl
|
|
10717
|
+
url: finnalUrl,
|
|
10718
|
+
seamlessSwitching: this._seamlessSwitching
|
|
10554
10719
|
});
|
|
10555
10720
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10556
10721
|
if (!this._loading) {
|
|
@@ -10728,7 +10893,7 @@
|
|
|
10728
10893
|
}();
|
|
10729
10894
|
var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
10730
10895
|
_inherits$3(FlvPlugin2, _BasePlugin);
|
|
10731
|
-
var _super = _createSuper$
|
|
10896
|
+
var _super = _createSuper$2(FlvPlugin2);
|
|
10732
10897
|
function FlvPlugin2() {
|
|
10733
10898
|
var _this;
|
|
10734
10899
|
_classCallCheck$4(this, FlvPlugin2);
|
|
@@ -10833,8 +10998,8 @@
|
|
|
10833
10998
|
BasePlugin.defineGetterOrSetter(this.player, {
|
|
10834
10999
|
url: {
|
|
10835
11000
|
get: function get() {
|
|
10836
|
-
var _this2$flv
|
|
10837
|
-
return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 :
|
|
11001
|
+
var _this2$flv;
|
|
11002
|
+
return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 : _this2$flv.blobUrl;
|
|
10838
11003
|
},
|
|
10839
11004
|
configurable: true
|
|
10840
11005
|
}
|
|
@@ -10872,6 +11037,7 @@
|
|
|
10872
11037
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
10873
11038
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
10874
11039
|
this._transCoreEvent(EVENT.KEYFRAME);
|
|
11040
|
+
this._transCoreEvent(EVENT.CHASEFRAME);
|
|
10875
11041
|
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
10876
11042
|
this._transCoreEvent(EVENT.SEI);
|
|
10877
11043
|
this._transCoreEvent(EVENT.SEI_IN_TIME);
|
|
@@ -10913,10 +11079,44 @@
|
|
|
10913
11079
|
value: function isSupported(mediaType, codec) {
|
|
10914
11080
|
return Flv.isSupported(mediaType, codec);
|
|
10915
11081
|
}
|
|
11082
|
+
}, {
|
|
11083
|
+
key: "isSupportedMMS",
|
|
11084
|
+
value: function isSupportedMMS() {
|
|
11085
|
+
return typeof ManagedMediaSource !== "undefined";
|
|
11086
|
+
}
|
|
10916
11087
|
}]);
|
|
10917
11088
|
return FlvPlugin2;
|
|
10918
11089
|
}(BasePlugin);
|
|
10919
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
|
+
}
|
|
10920
11120
|
function _classCallCheck(instance, Constructor) {
|
|
10921
11121
|
if (!(instance instanceof Constructor)) {
|
|
10922
11122
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -10972,21 +11172,6 @@
|
|
|
10972
11172
|
};
|
|
10973
11173
|
return _setPrototypeOf(o, p);
|
|
10974
11174
|
}
|
|
10975
|
-
function _isNativeReflectConstruct() {
|
|
10976
|
-
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
10977
|
-
return false;
|
|
10978
|
-
if (Reflect.construct.sham)
|
|
10979
|
-
return false;
|
|
10980
|
-
if (typeof Proxy === "function")
|
|
10981
|
-
return true;
|
|
10982
|
-
try {
|
|
10983
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
10984
|
-
}));
|
|
10985
|
-
return true;
|
|
10986
|
-
} catch (e) {
|
|
10987
|
-
return false;
|
|
10988
|
-
}
|
|
10989
|
-
}
|
|
10990
11175
|
function _assertThisInitialized(self2) {
|
|
10991
11176
|
if (self2 === void 0) {
|
|
10992
11177
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -11001,41 +11186,11 @@
|
|
|
11001
11186
|
}
|
|
11002
11187
|
return _assertThisInitialized(self2);
|
|
11003
11188
|
}
|
|
11004
|
-
function _createSuper(Derived) {
|
|
11005
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
11006
|
-
return function _createSuperInternal() {
|
|
11007
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
11008
|
-
if (hasNativeReflectConstruct) {
|
|
11009
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
11010
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
11011
|
-
} else {
|
|
11012
|
-
result = Super.apply(this, arguments);
|
|
11013
|
-
}
|
|
11014
|
-
return _possibleConstructorReturn(this, result);
|
|
11015
|
-
};
|
|
11016
|
-
}
|
|
11017
|
-
function _toPrimitive(input, hint) {
|
|
11018
|
-
if (typeof input !== "object" || input === null)
|
|
11019
|
-
return input;
|
|
11020
|
-
var prim = input[Symbol.toPrimitive];
|
|
11021
|
-
if (prim !== void 0) {
|
|
11022
|
-
var res = prim.call(input, hint || "default");
|
|
11023
|
-
if (typeof res !== "object")
|
|
11024
|
-
return res;
|
|
11025
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11026
|
-
}
|
|
11027
|
-
return (hint === "string" ? String : Number)(input);
|
|
11028
|
-
}
|
|
11029
|
-
function _toPropertyKey(arg) {
|
|
11030
|
-
var key = _toPrimitive(arg, "string");
|
|
11031
|
-
return typeof key === "symbol" ? key : String(key);
|
|
11032
|
-
}
|
|
11033
11189
|
var Adaptive = /* @__PURE__ */ function(_BasePlugin) {
|
|
11034
11190
|
_inherits(Adaptive2, _BasePlugin);
|
|
11035
|
-
var _super = _createSuper(Adaptive2);
|
|
11036
11191
|
function Adaptive2() {
|
|
11037
11192
|
_classCallCheck(this, Adaptive2);
|
|
11038
|
-
return
|
|
11193
|
+
return _callSuper(this, Adaptive2, arguments);
|
|
11039
11194
|
}
|
|
11040
11195
|
_createClass(Adaptive2, [{
|
|
11041
11196
|
key: "afterCreate",
|