@byteplus/veplayer-plugin 2.4.0-rc.2 → 2.4.0-rc.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/veplayer-plugin",
3
- "version": "2.4.0-rc.2",
3
+ "version": "2.4.0-rc.3",
4
4
  "main": "./umd/index.production.js",
5
5
  "module": "./esm/index.production.js",
6
6
  "browser": "./umd/index.production.js",
@@ -5053,6 +5053,8 @@
5053
5053
  _defineProperty$1(this, "_chunkSpeed", 0);
5054
5054
  _defineProperty$1(this, "_chunkCache", []);
5055
5055
  _defineProperty$1(this, "_speeds", []);
5056
+ _defineProperty$1(this, "_totalSize", 0);
5057
+ _defineProperty$1(this, "_totalCost", 0);
5056
5058
  this._opts = opts || {};
5057
5059
  }
5058
5060
  _createClass$2(BandwidthService2, [{
@@ -5069,6 +5071,8 @@
5069
5071
  var _this$_opts, _this$_opts2;
5070
5072
  if (!totalByte || !ms || totalByte < (((_this$_opts = this._opts) === null || _this$_opts === void 0 ? void 0 : _this$_opts.skipChunkSize) || SKIP_SMALL_CHUNK))
5071
5073
  return;
5074
+ this._totalSize += totalByte;
5075
+ this._totalCost += ms;
5072
5076
  this._chunkSpeed = 8e3 * totalByte / ms;
5073
5077
  this._chunkCache.push({
5074
5078
  size: totalByte,
@@ -5118,11 +5122,23 @@
5118
5122
  }
5119
5123
  return this._chunkSpeed;
5120
5124
  }
5125
+ }, {
5126
+ key: "getTotalSize",
5127
+ value: function getTotalSize() {
5128
+ return this._totalSize;
5129
+ }
5130
+ }, {
5131
+ key: "getTotalCost",
5132
+ value: function getTotalCost() {
5133
+ return this._totalCost;
5134
+ }
5121
5135
  }, {
5122
5136
  key: "reset",
5123
5137
  value: function reset() {
5124
5138
  this._chunkCache = [];
5125
5139
  this._speeds = [];
5140
+ this._totalSize = 0;
5141
+ this._totalCost = 0;
5126
5142
  }
5127
5143
  }]);
5128
5144
  return BandwidthService2;
@@ -5251,13 +5267,15 @@
5251
5267
  _createClass$2(MediaStatsService2, [{
5252
5268
  key: "getStats",
5253
5269
  value: function getStats() {
5254
- var _this$_core, _this$_core2, _this$_core2$speedInf, _this$_core3, _this$_core3$speedInf, _this$_core4, _this$_core4$bufferIn;
5270
+ 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;
5255
5271
  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;
5256
5272
  return _objectSpread2(_objectSpread2({}, this._stats.getStats()), {}, {
5257
5273
  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,
5258
5274
  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,
5275
+ 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,
5276
+ 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,
5259
5277
  currentTime,
5260
- bufferEnd: ((_this$_core4 = this._core) === null || _this$_core4 === void 0 ? void 0 : (_this$_core4$bufferIn = _this$_core4.bufferInfo()) === null || _this$_core4$bufferIn === void 0 ? void 0 : _this$_core4$bufferIn.remaining) || 0,
5278
+ 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,
5261
5279
  decodeFps
5262
5280
  });
5263
5281
  }
@@ -10451,7 +10469,7 @@
10451
10469
  _createClass$4(Flv2, [{
10452
10470
  key: "version",
10453
10471
  get: function get() {
10454
- return "3.0.18-alpha.3";
10472
+ return "3.0.18-alpha.5";
10455
10473
  }
10456
10474
  }, {
10457
10475
  key: "isLive",
@@ -10485,7 +10503,9 @@
10485
10503
  value: function speedInfo() {
10486
10504
  return {
10487
10505
  speed: this._bandwidthService.getLatestSpeed(),
10488
- avgSpeed: this._bandwidthService.getAvgSpeed()
10506
+ avgSpeed: this._bandwidthService.getAvgSpeed(),
10507
+ totalSize: this._bandwidthService.getTotalSize(),
10508
+ totalCost: this._bandwidthService.getTotalCost()
10489
10509
  };
10490
10510
  }
10491
10511
  }, {
@@ -10775,7 +10795,7 @@
10775
10795
  _context9.prev = 17;
10776
10796
  _context9.t0 = _context9["catch"](12);
10777
10797
  this._loading = false;
10778
- return _context9.abrupt("return", this._emitError(StreamingError.network(_context9.t0)));
10798
+ return _context9.abrupt("return", this._emitError(StreamingError.network(_context9.t0), false));
10779
10799
  case 21:
10780
10800
  case "end":
10781
10801
  return _context9.stop();