@volcengine/veplayer-plugin 2.4.0-rc.3 → 2.4.0-rc.4
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.development.js +133 -43
- package/esm/index.production.js +3 -3
- package/esm/veplayer.plugin.flv.development.js +21 -7
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +104 -28
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.flv.development.js +21 -7
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +104 -28
- package/umd/veplayer.plugin.hls.production.js +1 -1
|
@@ -1640,7 +1640,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
return offsetTime;
|
|
1642
1642
|
};
|
|
1643
|
-
var version = "3.0.
|
|
1643
|
+
var version = "3.0.19-rc.0";
|
|
1644
1644
|
var ERROR_MAP = {
|
|
1645
1645
|
1: 5101,
|
|
1646
1646
|
2: 5102,
|
|
@@ -2889,6 +2889,7 @@ var ERR = {
|
|
|
2889
2889
|
MSE_APPEND_BUFFER: "MSE_APPEND_BUFFER",
|
|
2890
2890
|
MSE_OTHER: "MSE_OTHER",
|
|
2891
2891
|
MSE_FULL: "MSE_FULL",
|
|
2892
|
+
MSE_CHANGE_TYPE: "MSE_CHANGE_TYPE",
|
|
2892
2893
|
OPTION: "OPTION",
|
|
2893
2894
|
DASH: "DASH",
|
|
2894
2895
|
LICENSE: "LICENSE",
|
|
@@ -2931,6 +2932,7 @@ var ERR_CODE = (_ERR_CODE = {}, _defineProperty$1(_ERR_CODE, ERR.MANIFEST, {
|
|
|
2931
2932
|
MSE_OTHER: 5202,
|
|
2932
2933
|
MSE_FULL: 5203,
|
|
2933
2934
|
MSE_HIJACK: 5204,
|
|
2935
|
+
MSE_CHANGE_TYPE: 5205,
|
|
2934
2936
|
EME_HIJACK: 5301
|
|
2935
2937
|
}), _defineProperty$1(_ERR_CODE, ERR.DRM, {
|
|
2936
2938
|
LICENSE: 7100,
|
|
@@ -3266,7 +3268,7 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3266
3268
|
queue.shift();
|
|
3267
3269
|
}
|
|
3268
3270
|
if (op) {
|
|
3269
|
-
var _this2$_sourceBuffer
|
|
3271
|
+
var _this2$_sourceBuffer$, _op$context;
|
|
3270
3272
|
var costtime = nowTime() - _this2._opst;
|
|
3271
3273
|
_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);
|
|
3272
3274
|
op.promise.resolve({
|
|
@@ -3274,6 +3276,10 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3274
3276
|
context: op.context,
|
|
3275
3277
|
costtime
|
|
3276
3278
|
});
|
|
3279
|
+
var callback = (_op$context = op.context) === null || _op$context === void 0 ? void 0 : _op$context.callback;
|
|
3280
|
+
if (callback && typeof callback === "function") {
|
|
3281
|
+
callback(op.context);
|
|
3282
|
+
}
|
|
3277
3283
|
_this2._startQueue(type);
|
|
3278
3284
|
}
|
|
3279
3285
|
}
|
|
@@ -3535,10 +3541,15 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3535
3541
|
var sb = this._sourceBuffer[type];
|
|
3536
3542
|
if (!this.mediaSource || !sb || sb.mimeType === mimeType)
|
|
3537
3543
|
return Promise.resolve();
|
|
3538
|
-
if (typeof sb.changeType !== "function")
|
|
3539
|
-
return Promise.reject();
|
|
3544
|
+
if (typeof sb.changeType !== "function") {
|
|
3545
|
+
return Promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_CHANGE_TYPE, new Error("changeType is not a function")));
|
|
3546
|
+
}
|
|
3540
3547
|
return this._enqueueOp(type, function() {
|
|
3541
|
-
|
|
3548
|
+
try {
|
|
3549
|
+
sb.changeType(mimeType);
|
|
3550
|
+
} catch (e) {
|
|
3551
|
+
throw new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_CHANGE_TYPE, e);
|
|
3552
|
+
}
|
|
3542
3553
|
sb.mimeType = mimeType;
|
|
3543
3554
|
_this8._onSBUpdateEnd(type);
|
|
3544
3555
|
}, "changeType", {
|
|
@@ -3788,11 +3799,14 @@ var MSE = /* @__PURE__ */ function() {
|
|
|
3788
3799
|
} catch (error) {
|
|
3789
3800
|
if (error && error.message && error.message.indexOf("SourceBuffer is full") >= 0) {
|
|
3790
3801
|
this._mseFullFlag[type] = true;
|
|
3802
|
+
if (op.context && _typeof(op.context) === "object") {
|
|
3803
|
+
op.context.isFull = true;
|
|
3804
|
+
}
|
|
3791
3805
|
this._logger.error("[MSE error], context,", op.context, " ,name,", op.opName, ",err,SourceBuffer is full");
|
|
3792
3806
|
op.promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_FULL, error));
|
|
3793
3807
|
} else {
|
|
3794
3808
|
this._logger.error(error);
|
|
3795
|
-
op.promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_OTHER, error));
|
|
3809
|
+
op.promise.reject(error.constructor === StreamingError ? error : new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_OTHER, error));
|
|
3796
3810
|
queue.shift();
|
|
3797
3811
|
this._startQueue(type);
|
|
3798
3812
|
}
|
|
@@ -5142,11 +5156,19 @@ var SeiService = /* @__PURE__ */ function() {
|
|
|
5142
5156
|
}]);
|
|
5143
5157
|
return SeiService2;
|
|
5144
5158
|
}();
|
|
5159
|
+
var SKIP_SMALL_CHUNK = 1e3;
|
|
5160
|
+
var MAX_CHUNK_SAVE_SIZE = 50;
|
|
5161
|
+
var MAX_SEGMENT_SAVE_SIZE = 3;
|
|
5162
|
+
var LONGTIME_NO_RECEIVE = 3e3;
|
|
5145
5163
|
var BandwidthService = /* @__PURE__ */ function() {
|
|
5146
|
-
function BandwidthService2() {
|
|
5164
|
+
function BandwidthService2(opts) {
|
|
5147
5165
|
_classCallCheck$1(this, BandwidthService2);
|
|
5148
|
-
_defineProperty$1(this, "
|
|
5166
|
+
_defineProperty$1(this, "_chunkSpeed", 0);
|
|
5167
|
+
_defineProperty$1(this, "_chunkCache", []);
|
|
5149
5168
|
_defineProperty$1(this, "_speeds", []);
|
|
5169
|
+
_defineProperty$1(this, "_totalSize", 0);
|
|
5170
|
+
_defineProperty$1(this, "_totalCost", 0);
|
|
5171
|
+
this._opts = opts || {};
|
|
5150
5172
|
}
|
|
5151
5173
|
_createClass$1(BandwidthService2, [{
|
|
5152
5174
|
key: "addRecord",
|
|
@@ -5154,45 +5176,82 @@ var BandwidthService = /* @__PURE__ */ function() {
|
|
|
5154
5176
|
if (!totalByte || !ms)
|
|
5155
5177
|
return;
|
|
5156
5178
|
this._speeds.push(8e3 * totalByte / ms);
|
|
5157
|
-
this._speeds = this._speeds.slice(-
|
|
5179
|
+
this._speeds = this._speeds.slice(-MAX_SEGMENT_SAVE_SIZE);
|
|
5158
5180
|
}
|
|
5159
5181
|
}, {
|
|
5160
5182
|
key: "addChunkRecord",
|
|
5161
5183
|
value: function addChunkRecord(totalByte, ms) {
|
|
5162
|
-
|
|
5184
|
+
var _this$_opts, _this$_opts2;
|
|
5185
|
+
if (!totalByte || !ms || totalByte < (((_this$_opts = this._opts) === null || _this$_opts === void 0 ? void 0 : _this$_opts.skipChunkSize) || SKIP_SMALL_CHUNK))
|
|
5163
5186
|
return;
|
|
5164
|
-
this.
|
|
5165
|
-
this.
|
|
5187
|
+
this._totalSize += totalByte;
|
|
5188
|
+
this._totalCost += ms;
|
|
5189
|
+
this._chunkSpeed = 8e3 * totalByte / ms;
|
|
5190
|
+
this._chunkCache.push({
|
|
5191
|
+
size: totalByte,
|
|
5192
|
+
duration: ms,
|
|
5193
|
+
timestamp: performance.now()
|
|
5194
|
+
});
|
|
5195
|
+
var size = ((_this$_opts2 = this._opts) === null || _this$_opts2 === void 0 ? void 0 : _this$_opts2.chunkCountForSpeed) || MAX_CHUNK_SAVE_SIZE;
|
|
5196
|
+
if (this._chunkCache.length > size) {
|
|
5197
|
+
this._chunkCache = this._chunkCache.slice(-size);
|
|
5198
|
+
}
|
|
5166
5199
|
}
|
|
5167
5200
|
}, {
|
|
5168
5201
|
key: "getAvgSpeed",
|
|
5169
5202
|
value: function getAvgSpeed() {
|
|
5170
|
-
|
|
5203
|
+
var _this$_opts3;
|
|
5204
|
+
if (!this._chunkCache.length && !this._speeds.length)
|
|
5171
5205
|
return 0;
|
|
5172
5206
|
if (this._speeds.length) {
|
|
5173
5207
|
return this._speeds.reduce(function(a, c) {
|
|
5174
5208
|
return a += c;
|
|
5175
5209
|
}) / this._speeds.length;
|
|
5176
5210
|
}
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5211
|
+
var lastSample = this._chunkCache[this._chunkCache.length - 1];
|
|
5212
|
+
var cost = performance.now() - lastSample.timestamp;
|
|
5213
|
+
if (cost > (((_this$_opts3 = this._opts) === null || _this$_opts3 === void 0 ? void 0 : _this$_opts3.longtimeNoReceived) || LONGTIME_NO_RECEIVE)) {
|
|
5214
|
+
this._chunkCache.push({
|
|
5215
|
+
size: 0,
|
|
5216
|
+
duration: cost,
|
|
5217
|
+
timestamp: performance.now()
|
|
5218
|
+
});
|
|
5219
|
+
}
|
|
5220
|
+
var totalSize = this._chunkCache.reduce(function(a, c) {
|
|
5221
|
+
return a += c.size;
|
|
5222
|
+
}, 0);
|
|
5223
|
+
var totalDuration = this._chunkCache.reduce(function(a, c) {
|
|
5224
|
+
return a += c.duration;
|
|
5225
|
+
}, 0);
|
|
5226
|
+
return 8e3 * totalSize / totalDuration;
|
|
5180
5227
|
}
|
|
5181
5228
|
}, {
|
|
5182
5229
|
key: "getLatestSpeed",
|
|
5183
5230
|
value: function getLatestSpeed() {
|
|
5184
|
-
if (!this.
|
|
5231
|
+
if (!this._chunkCache.length && !this._speeds.length)
|
|
5185
5232
|
return 0;
|
|
5186
5233
|
if (this._speeds.length) {
|
|
5187
5234
|
return this._speeds[this._speeds.length - 1];
|
|
5188
5235
|
}
|
|
5189
|
-
return this.
|
|
5236
|
+
return this._chunkSpeed;
|
|
5237
|
+
}
|
|
5238
|
+
}, {
|
|
5239
|
+
key: "getTotalSize",
|
|
5240
|
+
value: function getTotalSize() {
|
|
5241
|
+
return this._totalSize;
|
|
5242
|
+
}
|
|
5243
|
+
}, {
|
|
5244
|
+
key: "getTotalCost",
|
|
5245
|
+
value: function getTotalCost() {
|
|
5246
|
+
return this._totalCost;
|
|
5190
5247
|
}
|
|
5191
5248
|
}, {
|
|
5192
5249
|
key: "reset",
|
|
5193
5250
|
value: function reset() {
|
|
5194
|
-
this.
|
|
5251
|
+
this._chunkCache = [];
|
|
5195
5252
|
this._speeds = [];
|
|
5253
|
+
this._totalSize = 0;
|
|
5254
|
+
this._totalCost = 0;
|
|
5196
5255
|
}
|
|
5197
5256
|
}]);
|
|
5198
5257
|
return BandwidthService2;
|
|
@@ -5321,13 +5380,15 @@ var MediaStatsService = /* @__PURE__ */ function() {
|
|
|
5321
5380
|
_createClass$1(MediaStatsService2, [{
|
|
5322
5381
|
key: "getStats",
|
|
5323
5382
|
value: function getStats() {
|
|
5324
|
-
var _this$_core, _this$_core2, _this$_core2$speedInf, _this$_core3, _this$_core3$speedInf, _this$_core4, _this$_core4$bufferIn;
|
|
5383
|
+
var _this$_core, _this$_core2, _this$_core2$speedInf, _this$_core3, _this$_core3$speedInf, _this$_core4, _this$_core4$speedInf, _this$_core5, _this$_core5$speedInf, _this$_core6, _this$_core6$bufferIn;
|
|
5325
5384
|
var _ref2 = ((_this$_core = this._core) === null || _this$_core === void 0 ? void 0 : _this$_core.media) || {}, _ref2$currentTime = _ref2.currentTime, currentTime = _ref2$currentTime === void 0 ? 0 : _ref2$currentTime, _ref2$decodeFps = _ref2.decodeFps, decodeFps = _ref2$decodeFps === void 0 ? 0 : _ref2$decodeFps;
|
|
5326
5385
|
return _objectSpread2(_objectSpread2({}, this._stats.getStats()), {}, {
|
|
5327
5386
|
downloadSpeed: ((_this$_core2 = this._core) === null || _this$_core2 === void 0 ? void 0 : (_this$_core2$speedInf = _this$_core2.speedInfo) === null || _this$_core2$speedInf === void 0 ? void 0 : _this$_core2$speedInf.call(_this$_core2).speed) || 0,
|
|
5328
5387
|
avgSpeed: ((_this$_core3 = this._core) === null || _this$_core3 === void 0 ? void 0 : (_this$_core3$speedInf = _this$_core3.speedInfo) === null || _this$_core3$speedInf === void 0 ? void 0 : _this$_core3$speedInf.call(_this$_core3).avgSpeed) || 0,
|
|
5388
|
+
totalReceivedByte: ((_this$_core4 = this._core) === null || _this$_core4 === void 0 ? void 0 : (_this$_core4$speedInf = _this$_core4.speedInfo) === null || _this$_core4$speedInf === void 0 ? void 0 : _this$_core4$speedInf.call(_this$_core4).totalSize) || 0,
|
|
5389
|
+
totalReceivedCost: ((_this$_core5 = this._core) === null || _this$_core5 === void 0 ? void 0 : (_this$_core5$speedInf = _this$_core5.speedInfo) === null || _this$_core5$speedInf === void 0 ? void 0 : _this$_core5$speedInf.call(_this$_core5).totalCost) || 0,
|
|
5329
5390
|
currentTime,
|
|
5330
|
-
bufferEnd: ((_this$
|
|
5391
|
+
bufferEnd: ((_this$_core6 = this._core) === null || _this$_core6 === void 0 ? void 0 : (_this$_core6$bufferIn = _this$_core6.bufferInfo()) === null || _this$_core6$bufferIn === void 0 ? void 0 : _this$_core6$bufferIn.remaining) || 0,
|
|
5331
5392
|
decodeFps
|
|
5332
5393
|
});
|
|
5333
5394
|
}
|
|
@@ -11203,7 +11264,9 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11203
11264
|
mse = this._mse;
|
|
11204
11265
|
_p = [];
|
|
11205
11266
|
if (needInit && !isFirstAppend) {
|
|
11206
|
-
this._handleCodecChange(video, audio)
|
|
11267
|
+
this._handleCodecChange(video, audio).forEach(function(task) {
|
|
11268
|
+
return _p.push(task);
|
|
11269
|
+
});
|
|
11207
11270
|
}
|
|
11208
11271
|
if (video) {
|
|
11209
11272
|
videoData = video.data, videoRest = _objectWithoutProperties$1(video, _excluded);
|
|
@@ -11476,6 +11539,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11476
11539
|
}, {
|
|
11477
11540
|
key: "_handleCodecChange",
|
|
11478
11541
|
value: function _handleCodecChange(video, audio) {
|
|
11542
|
+
var tasks = [];
|
|
11479
11543
|
var mse = this._mse;
|
|
11480
11544
|
var codecList = [{
|
|
11481
11545
|
type: MSE.VIDEO,
|
|
@@ -11492,10 +11556,11 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11492
11556
|
if (sourceBuffer) {
|
|
11493
11557
|
var codec = codecs.split(",")[0];
|
|
11494
11558
|
if (!new RegExp(codec, "ig").test(sourceBuffer.mimeType)) {
|
|
11495
|
-
mse.changeType(type, "".concat(type, "/mp4;codecs=").concat(codecs));
|
|
11559
|
+
tasks.push(mse.changeType(type, "".concat(type, "/mp4;codecs=").concat(codecs)));
|
|
11496
11560
|
}
|
|
11497
11561
|
}
|
|
11498
11562
|
});
|
|
11563
|
+
return tasks;
|
|
11499
11564
|
}
|
|
11500
11565
|
}, {
|
|
11501
11566
|
key: "seamlessSwitch",
|
|
@@ -11554,10 +11619,21 @@ var MediaType = {
|
|
|
11554
11619
|
};
|
|
11555
11620
|
var KeySystems = {
|
|
11556
11621
|
CLEAR_KEY: "org.w3.clearkey",
|
|
11557
|
-
FAIRPLAY: "com.apple.streamingkeydelivery",
|
|
11558
|
-
WIDEVINE: "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
|
|
11559
|
-
PLAYREADY: "com.microsoft.playready"
|
|
11622
|
+
FAIRPLAY: ["urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2", "com.apple.streamingkeydelivery"],
|
|
11623
|
+
WIDEVINE: ["urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", "com.widevine.alpha", "com.widevine"],
|
|
11624
|
+
PLAYREADY: ["urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95", "com.microsoft.playready"]
|
|
11560
11625
|
};
|
|
11626
|
+
function flatArray(arr) {
|
|
11627
|
+
var ret = [];
|
|
11628
|
+
for (var i = 0; i < arr.length; i++) {
|
|
11629
|
+
if (Array.isArray(arr[i])) {
|
|
11630
|
+
ret = ret.concat(flatArray(arr[i]));
|
|
11631
|
+
} else {
|
|
11632
|
+
ret.push(arr[i]);
|
|
11633
|
+
}
|
|
11634
|
+
}
|
|
11635
|
+
return ret;
|
|
11636
|
+
}
|
|
11561
11637
|
var MediaStream = /* @__PURE__ */ _createClass$3(function MediaStream2() {
|
|
11562
11638
|
_classCallCheck$3(this, MediaStream2);
|
|
11563
11639
|
_defineProperty$3(this, "id", 0);
|
|
@@ -11734,7 +11810,7 @@ var MediaSegmentKey = /* @__PURE__ */ function() {
|
|
|
11734
11810
|
}, {
|
|
11735
11811
|
key: "isValidKeySystem",
|
|
11736
11812
|
value: function isValidKeySystem() {
|
|
11737
|
-
var isKeyFormatValid = [KeySystems.CLEAR_KEY, KeySystems.FAIRPLAY, KeySystems.WIDEVINE, KeySystems.PLAYREADY].indexOf(this.keyFormat) > -1;
|
|
11813
|
+
var isKeyFormatValid = flatArray([KeySystems.CLEAR_KEY, KeySystems.FAIRPLAY, KeySystems.WIDEVINE, KeySystems.PLAYREADY]).indexOf(this.keyFormat) > -1;
|
|
11738
11814
|
if (!isKeyFormatValid) {
|
|
11739
11815
|
return false;
|
|
11740
11816
|
}
|
|
@@ -14519,7 +14595,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14519
14595
|
}]);
|
|
14520
14596
|
return Hls2;
|
|
14521
14597
|
}(EventEmitter);
|
|
14522
|
-
_defineProperty$3(Hls, "version", "3.0.
|
|
14598
|
+
_defineProperty$3(Hls, "version", "3.0.19-rc.0");
|
|
14523
14599
|
try {
|
|
14524
14600
|
if (localStorage.getItem("xgd")) {
|
|
14525
14601
|
Hls.enableLogger();
|