@byteplus/veplayer-plugin 2.11.0-rc.0 → 2.11.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.
Files changed (33) hide show
  1. package/esm/ad.d.ts +3 -0
  2. package/esm/hlsjs.d.ts +3 -0
  3. package/esm/index.development.js +531 -244
  4. package/esm/index.production.js +1 -1
  5. package/esm/time-shift.d.ts +3 -0
  6. package/esm/veplayer.plugin.abr.development.js +1 -1
  7. package/esm/veplayer.plugin.abr.production.js +1 -1
  8. package/esm/veplayer.plugin.drm.development.js +1 -1
  9. package/esm/veplayer.plugin.drm.production.js +1 -1
  10. package/esm/veplayer.plugin.flv.development.js +1 -1
  11. package/esm/veplayer.plugin.flv.production.js +1 -1
  12. package/esm/veplayer.plugin.hls.development.js +1 -1
  13. package/esm/veplayer.plugin.hls.production.js +1 -1
  14. package/esm/veplayer.plugin.hlsjs.development.js +496 -218
  15. package/esm/veplayer.plugin.hlsjs.production.js +1 -1
  16. package/esm/veplayer.plugin.rtm.development.js +37 -28
  17. package/esm/veplayer.plugin.rtm.production.js +1 -1
  18. package/esm/veplayer.plugin.time.shift.development.js +13 -16
  19. package/esm/veplayer.plugin.time.shift.production.js +1 -1
  20. package/esm/veplayer.plugin.xgvideo.development.js +1 -1
  21. package/esm/veplayer.plugin.xgvideo.production.js +1 -1
  22. package/esm/veplayer.strategy.base.development.js +1 -1
  23. package/esm/veplayer.strategy.base.production.js +1 -1
  24. package/esm/veplayer.strategy.rtm.adaptive.buffer.development.js +1 -1
  25. package/esm/veplayer.strategy.rtm.adaptive.buffer.production.js +1 -1
  26. package/package.json +106 -2
  27. package/umd/ad.d.ts +3 -0
  28. package/umd/hlsjs.d.ts +3 -0
  29. package/umd/time-shift.d.ts +3 -0
  30. package/umd/veplayer.plugin.hlsjs.development.js +495 -217
  31. package/umd/veplayer.plugin.hlsjs.production.js +1 -1
  32. package/umd/veplayer.plugin.rtm.development.js +36 -27
  33. package/umd/veplayer.plugin.rtm.production.js +1 -1
@@ -7180,6 +7180,9 @@
7180
7180
  function isVivoBrowser() {
7181
7181
  return /(VivoBrowser)/i.test(navigator.userAgent);
7182
7182
  }
7183
+ function isPositiveNumber(num) {
7184
+ return typeof num === "number" && num > 0;
7185
+ }
7183
7186
  var VideoFrameRecvCallback = /* @__PURE__ */ function() {
7184
7187
  function VideoFrameRecvCallback2() {
7185
7188
  var _this = this;
@@ -7270,7 +7273,8 @@
7270
7273
  clearTimeout(_this._checkStatsErrorTimer);
7271
7274
  }
7272
7275
  _this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
7273
- var stats, _stats$video, framesDecoded, bytesReceived;
7276
+ var _stats$video, _stats$audio, _stats$video2, _stats$video3;
7277
+ var stats;
7274
7278
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
7275
7279
  while (1)
7276
7280
  switch (_context.prev = _context.next) {
@@ -7279,19 +7283,17 @@
7279
7283
  return _this.getStatsSnapshoot();
7280
7284
  case 2:
7281
7285
  stats = _context.sent;
7282
- if (stats.video) {
7283
- _stats$video = stats.video, framesDecoded = _stats$video.framesDecoded, bytesReceived = _stats$video.bytesReceived;
7284
- if (!bytesReceived) {
7285
- _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7286
- message: "rts receive empty"
7287
- }));
7288
- } else if (!framesDecoded) {
7289
- _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7290
- message: "rts decode error"
7291
- }));
7292
- }
7286
+ if (!isPositiveNumber((_stats$video = stats.video) === null || _stats$video === void 0 ? void 0 : _stats$video.bytesReceived) && !isPositiveNumber((_stats$audio = stats.audio) === null || _stats$audio === void 0 ? void 0 : _stats$audio.bytesReceived)) {
7287
+ _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7288
+ message: "rts receive empty"
7289
+ }));
7293
7290
  }
7294
- case 4:
7291
+ if (isPositiveNumber((_stats$video2 = stats.video) === null || _stats$video2 === void 0 ? void 0 : _stats$video2.bytesReceived) && !isPositiveNumber((_stats$video3 = stats.video) === null || _stats$video3 === void 0 ? void 0 : _stats$video3.framesDecoded)) {
7292
+ _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7293
+ message: "rts decode error"
7294
+ }));
7295
+ }
7296
+ case 5:
7295
7297
  case "end":
7296
7298
  return _context.stop();
7297
7299
  }
@@ -7709,6 +7711,7 @@
7709
7711
  value: function _bindRTCEvents(pc) {
7710
7712
  var _this3 = this;
7711
7713
  pc.addEventListener("track", this._onTrack);
7714
+ var firstConnect = true;
7712
7715
  pc.addEventListener("connectionstatechange", function() {
7713
7716
  logger.warn("onconnectionstatechange:", pc.connectionState);
7714
7717
  _this3._clearPeerStateTimeout();
@@ -7716,26 +7719,31 @@
7716
7719
  state: pc.connectionState,
7717
7720
  url: _this3._url
7718
7721
  });
7719
- if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
7720
- _this3.emit("waiting");
7721
- _this3._stopRtcReport();
7722
- }
7723
7722
  if (pc.connectionState === "failed") {
7723
+ var _this3$_preAudioStats, _this3$_preVideoStats;
7724
+ var reason = isPositiveNumber((_this3$_preAudioStats = _this3._preAudioStats) === null || _this3$_preAudioStats === void 0 ? void 0 : _this3$_preAudioStats.bytesReceived) && !isPositiveNumber((_this3$_preVideoStats = _this3._preVideoStats) === null || _this3$_preVideoStats === void 0 ? void 0 : _this3$_preVideoStats.bytesReceived) ? "rtc connect failed(only audio)" : "rtc connect failed";
7724
7725
  if (_this3._retry === 0) {
7725
- _this3._emitError(StreamingError.network(new Error("rtc connect failed")));
7726
+ _this3._emitError(StreamingError.network(new Error(reason)));
7726
7727
  return;
7727
7728
  }
7728
7729
  _this3._retry--;
7729
- _this3.load(_this3._url, "rtc connect failed");
7730
+ _this3.load(_this3._url, reason);
7731
+ }
7732
+ if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
7733
+ _this3.emit("waiting");
7734
+ _this3._stopRtcReport();
7730
7735
  }
7731
7736
  if (pc.connectionState === "connected") {
7732
- _this3._handleMediaStream();
7733
- _this3.emit(EVENT.TTFB, {
7734
- url: _this3._url,
7735
- responseUrl: _this3._url,
7736
- elapsed: Date.now() - _this3._rctConnectStartTs
7737
- });
7738
- _this3._checkStatsError();
7737
+ if (firstConnect) {
7738
+ firstConnect = false;
7739
+ _this3._handleMediaStream();
7740
+ _this3.emit(EVENT.TTFB, {
7741
+ url: _this3._url,
7742
+ responseUrl: _this3._url,
7743
+ elapsed: Date.now() - _this3._rctConnectStartTs
7744
+ });
7745
+ _this3._checkStatsError();
7746
+ }
7739
7747
  _this3._startRtcReport();
7740
7748
  }
7741
7749
  });
@@ -8306,6 +8314,7 @@
8306
8314
  this._firstFrameObserver.reset();
8307
8315
  this.emit(EVENT.ERROR, error);
8308
8316
  clearTimeout(this._checkStatsErrorTimer);
8317
+ this._stopRtcReport();
8309
8318
  this._clearPeerStateTimeout();
8310
8319
  if (this._pc) {
8311
8320
  this._pc.close();
@@ -8565,7 +8574,7 @@
8565
8574
  }, {
8566
8575
  key: "version",
8567
8576
  get: function get() {
8568
- return "0.2.1-alpha.53";
8577
+ return "0.2.1-alpha.57";
8569
8578
  }
8570
8579
  }, {
8571
8580
  key: "beforePlayerInit",