@volcengine/veplayer-plugin 2.11.0-rc.0 → 2.11.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.
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
@@ -1,3 +1,4 @@
1
+ import { DynamicModule } from "@volcengine/veplayer";
1
2
  function _iterableToArrayLimit(arr, i) {
2
3
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3
4
  if (null != _i) {
@@ -7176,6 +7177,9 @@ function isHeyTapBrowser() {
7176
7177
  function isVivoBrowser() {
7177
7178
  return /(VivoBrowser)/i.test(navigator.userAgent);
7178
7179
  }
7180
+ function isPositiveNumber(num) {
7181
+ return typeof num === "number" && num > 0;
7182
+ }
7179
7183
  var VideoFrameRecvCallback = /* @__PURE__ */ function() {
7180
7184
  function VideoFrameRecvCallback2() {
7181
7185
  var _this = this;
@@ -7266,7 +7270,8 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7266
7270
  clearTimeout(_this._checkStatsErrorTimer);
7267
7271
  }
7268
7272
  _this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
7269
- var stats, _stats$video, framesDecoded, bytesReceived;
7273
+ var _stats$video, _stats$audio, _stats$video2, _stats$video3;
7274
+ var stats;
7270
7275
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
7271
7276
  while (1)
7272
7277
  switch (_context.prev = _context.next) {
@@ -7275,19 +7280,17 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7275
7280
  return _this.getStatsSnapshoot();
7276
7281
  case 2:
7277
7282
  stats = _context.sent;
7278
- if (stats.video) {
7279
- _stats$video = stats.video, framesDecoded = _stats$video.framesDecoded, bytesReceived = _stats$video.bytesReceived;
7280
- if (!bytesReceived) {
7281
- _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7282
- message: "rts receive empty"
7283
- }));
7284
- } else if (!framesDecoded) {
7285
- _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7286
- message: "rts decode error"
7287
- }));
7288
- }
7283
+ 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)) {
7284
+ _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7285
+ message: "rts receive empty"
7286
+ }));
7289
7287
  }
7290
- case 4:
7288
+ 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)) {
7289
+ _this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
7290
+ message: "rts decode error"
7291
+ }));
7292
+ }
7293
+ case 5:
7291
7294
  case "end":
7292
7295
  return _context.stop();
7293
7296
  }
@@ -7705,6 +7708,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7705
7708
  value: function _bindRTCEvents(pc) {
7706
7709
  var _this3 = this;
7707
7710
  pc.addEventListener("track", this._onTrack);
7711
+ var firstConnect = true;
7708
7712
  pc.addEventListener("connectionstatechange", function() {
7709
7713
  logger.warn("onconnectionstatechange:", pc.connectionState);
7710
7714
  _this3._clearPeerStateTimeout();
@@ -7712,26 +7716,31 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7712
7716
  state: pc.connectionState,
7713
7717
  url: _this3._url
7714
7718
  });
7715
- if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
7716
- _this3.emit("waiting");
7717
- _this3._stopRtcReport();
7718
- }
7719
7719
  if (pc.connectionState === "failed") {
7720
+ var _this3$_preAudioStats, _this3$_preVideoStats;
7721
+ 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";
7720
7722
  if (_this3._retry === 0) {
7721
- _this3._emitError(StreamingError.network(new Error("rtc connect failed")));
7723
+ _this3._emitError(StreamingError.network(new Error(reason)));
7722
7724
  return;
7723
7725
  }
7724
7726
  _this3._retry--;
7725
- _this3.load(_this3._url, "rtc connect failed");
7727
+ _this3.load(_this3._url, reason);
7728
+ }
7729
+ if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
7730
+ _this3.emit("waiting");
7731
+ _this3._stopRtcReport();
7726
7732
  }
7727
7733
  if (pc.connectionState === "connected") {
7728
- _this3._handleMediaStream();
7729
- _this3.emit(EVENT.TTFB, {
7730
- url: _this3._url,
7731
- responseUrl: _this3._url,
7732
- elapsed: Date.now() - _this3._rctConnectStartTs
7733
- });
7734
- _this3._checkStatsError();
7734
+ if (firstConnect) {
7735
+ firstConnect = false;
7736
+ _this3._handleMediaStream();
7737
+ _this3.emit(EVENT.TTFB, {
7738
+ url: _this3._url,
7739
+ responseUrl: _this3._url,
7740
+ elapsed: Date.now() - _this3._rctConnectStartTs
7741
+ });
7742
+ _this3._checkStatsError();
7743
+ }
7735
7744
  _this3._startRtcReport();
7736
7745
  }
7737
7746
  });
@@ -8302,6 +8311,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8302
8311
  this._firstFrameObserver.reset();
8303
8312
  this.emit(EVENT.ERROR, error);
8304
8313
  clearTimeout(this._checkStatsErrorTimer);
8314
+ this._stopRtcReport();
8305
8315
  this._clearPeerStateTimeout();
8306
8316
  if (this._pc) {
8307
8317
  this._pc.close();
@@ -8561,7 +8571,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8561
8571
  }, {
8562
8572
  key: "version",
8563
8573
  get: function get() {
8564
- return "0.2.1-alpha.53";
8574
+ return "0.2.1-alpha.57";
8565
8575
  }
8566
8576
  }, {
8567
8577
  key: "beforePlayerInit",
@@ -8801,7 +8811,6 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8801
8811
  }]);
8802
8812
  return RtsPlugin2;
8803
8813
  }(BasePlugin);
8804
- const DynamicModule = window["VePlayer"].DynamicModule;
8805
8814
  const __PLUGIN_NAME__ = DynamicModule.PluginRtm;
8806
8815
  export {
8807
8816
  RtsPlugin as RtmPlugin,