@volcengine/veplayer 2.4.0-rc.3 → 2.4.0-rc.5

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 (40) hide show
  1. package/esm/index.d.ts +22 -6
  2. package/esm/veplayer.biz.live.development.js +192 -102
  3. package/esm/veplayer.biz.live.production.js +1 -1
  4. package/esm/veplayer.d.ts +551 -106
  5. package/esm/veplayer.development.css +1 -1
  6. package/esm/veplayer.development.js +263 -134
  7. package/esm/veplayer.live.d.ts +551 -106
  8. package/esm/veplayer.live.development.css +1 -1
  9. package/esm/veplayer.live.development.js +263 -134
  10. package/esm/veplayer.live.production.css +1 -1
  11. package/esm/veplayer.live.production.js +3 -3
  12. package/esm/veplayer.production.css +1 -1
  13. package/esm/veplayer.production.js +3 -3
  14. package/esm/veplayer.vod.d.ts +22 -6
  15. package/esm/veplayer.vod.development.css +1 -1
  16. package/esm/veplayer.vod.development.js +65 -27
  17. package/esm/veplayer.vod.production.css +1 -1
  18. package/esm/veplayer.vod.production.js +2 -2
  19. package/package.json +1 -1
  20. package/umd/index.d.ts +22 -6
  21. package/umd/veplayer.biz.live.development.js +192 -102
  22. package/umd/veplayer.biz.live.production.js +1 -1
  23. package/umd/veplayer.d.ts +551 -106
  24. package/umd/veplayer.development.css +1 -1
  25. package/umd/veplayer.development.js +263 -134
  26. package/umd/veplayer.live.d.ts +551 -106
  27. package/umd/veplayer.live.development.css +1 -1
  28. package/umd/veplayer.live.development.js +263 -134
  29. package/umd/veplayer.live.production.css +1 -1
  30. package/umd/veplayer.live.production.js +1 -1
  31. package/umd/veplayer.production.css +1 -1
  32. package/umd/veplayer.production.js +1 -1
  33. package/umd/veplayer.vod.d.ts +22 -6
  34. package/umd/veplayer.vod.development.css +1 -1
  35. package/umd/veplayer.vod.development.js +65 -27
  36. package/umd/veplayer.vod.production.css +1 -1
  37. package/umd/veplayer.vod.production.js +1 -1
  38. package/veplayer.d.ts +551 -106
  39. package/veplayer.live.d.ts +551 -106
  40. package/veplayer.vod.d.ts +22 -6
package/esm/index.d.ts CHANGED
@@ -1729,6 +1729,11 @@ declare class VePlayerBase {
1729
1729
  * @brief Gets the current playback source ID.
1730
1730
  */
1731
1731
  get source(): string | undefined;
1732
+ /** {zh}
1733
+ * 获取播放器版本号
1734
+ * @returns
1735
+ */
1736
+ get playerVersion(): string;
1732
1737
  /** {zh}
1733
1738
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
1734
1739
  */
@@ -1851,6 +1856,12 @@ declare class VePlayerBase {
1851
1856
  *
1852
1857
  */
1853
1858
  fallbackToFirstDefinition?: boolean;
1859
+ /** {zh}
1860
+ * @brief 是否无缝切换
1861
+ * - true: 无缝切换
1862
+ * - false: 非无缝切换
1863
+ * @default false
1864
+ */
1854
1865
  seamless?: boolean;
1855
1866
  }): Promise<ExposedDefinition>;
1856
1867
  /** {zh}
@@ -2020,6 +2031,11 @@ declare class VePlayerBase {
2020
2031
  */
2021
2032
  ignorePaused?: boolean;
2022
2033
  }): void;
2034
+ /** {zh}
2035
+ * @brief 判断浏览器是否支持播放格式
2036
+ * @param type 播放格式
2037
+ * @returns
2038
+ */
2023
2039
  canPlayType(type: string): boolean;
2024
2040
  /** {zh}
2025
2041
  * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
@@ -4609,9 +4625,9 @@ declare namespace event {
4609
4625
  AUTOPLAY_SUCCESS: string;
4610
4626
  ERROR_REFRESH_CLICK: string;
4611
4627
  SOURCE_CHANGE: string;
4612
- SWITCH_DEFINITION_START: string;
4613
- SWITCH_DEFINITION_SUCCESS: string;
4614
- DOWN_DEFINITION: string;
4628
+ ABR_SWITCH_START: string;
4629
+ ABR_SWITCH_SUCCESS: string;
4630
+ ABR_SWITCH_FAILED: string;
4615
4631
  };
4616
4632
  const Events: {
4617
4633
  SEI: string;
@@ -4637,9 +4653,9 @@ declare namespace event {
4637
4653
  AUTOPLAY_SUCCESS: string;
4638
4654
  ERROR_REFRESH_CLICK: string;
4639
4655
  SOURCE_CHANGE: string;
4640
- SWITCH_DEFINITION_START: string;
4641
- SWITCH_DEFINITION_SUCCESS: string;
4642
- DOWN_DEFINITION: string;
4656
+ ABR_SWITCH_START: string;
4657
+ ABR_SWITCH_SUCCESS: string;
4658
+ ABR_SWITCH_FAILED: string;
4643
4659
  REPLAY: string;
4644
4660
  ERROR: string;
4645
4661
  PLAY: string;
@@ -883,7 +883,7 @@ function getCommonLog(options) {
883
883
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
884
884
  player_sdk_version: player.version,
885
885
  // eslint-disable-next-line no-undef
886
- logger_version: "1.1.0-alpha.7",
886
+ logger_version: "1.1.0-alpha.10",
887
887
  // 由rollup 在编译时注入
888
888
  report_version: "5",
889
889
  product_line: options.product_line,
@@ -1687,9 +1687,29 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1687
1687
  play_current_time: _this7.player.currentTime
1688
1688
  }, _this7.videoSize));
1689
1689
  return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
1690
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2({
1690
+ var flvStats = {};
1691
+ if (_this7.core) {
1692
+ if (_this7.core.getStats) {
1693
+ var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
1694
+ Object.assign(flvStats, {
1695
+ bitrate,
1696
+ avg_speed: avgSpeed,
1697
+ rate: avgSpeed / bitrate
1698
+ });
1699
+ }
1700
+ if (_this7.core.getNetWorkInfo) {
1701
+ var _this7$core$core;
1702
+ var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
1703
+ var _ref4 = ((_this7$core$core = _this7.core.core) === null || _this7$core$core === void 0 ? void 0 : _this7$core$core._opts) || {}, networkEvaluateInterval = _ref4.networkEvaluateInterval;
1704
+ Object.assign(flvStats, {
1705
+ lostRate,
1706
+ networkEvaluateInterval
1707
+ });
1708
+ }
1709
+ }
1710
+ _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
1691
1711
  play_time: first ? 0 : playedTime
1692
- }, stats)), true);
1712
+ }, stats), flvStats)), true);
1693
1713
  _this7.log.playing.download_speed_array = [];
1694
1714
  _this7.log.playing.stall_time = 0;
1695
1715
  _this7.log.playing.stall_count = 0;
@@ -1710,7 +1730,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1710
1730
  _this9.player.off("playing", _this9.handlePlayerPlaying);
1711
1731
  _this9.player.off("timeupdate", _this9.handlePlayerPlaying);
1712
1732
  if (_this9.core) {
1713
- var _ref2 = _this9.core.getStats() || {}, fps = _ref2.fps;
1733
+ var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
1714
1734
  _this9.commonParams.fps = fps;
1715
1735
  }
1716
1736
  return Promise.resolve(_this9.reportPlaying(true)).then(function() {
@@ -1721,7 +1741,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1721
1741
  var _temp4 = function() {
1722
1742
  if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
1723
1743
  var _temp5 = function() {
1724
- if (!_this9.player.video) {
1744
+ if (!_this9.player || !_this9.player.video) {
1725
1745
  _this9.destroyFunc();
1726
1746
  } else {
1727
1747
  var _temp6 = function() {
@@ -1954,24 +1974,30 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1954
1974
  this.player.off("bufferappend", this.handleBufferAppend);
1955
1975
  this.player.off("core_event", this.handleCoreEvent);
1956
1976
  this.player.off("degrade", this.handleDegrade);
1957
- this.clearPlayingInterval();
1958
- this.clearStallTimer();
1959
- this.clearPlayResultTimer();
1960
- clearTimeout(this.collectDownloadSpeedTimer);
1961
1977
  this._player = null;
1962
1978
  }
1963
- };
1964
- _proto2.handleUserLeave = function handleUserLeave() {
1965
- if (this.destroyed || !this.started) {
1966
- return;
1967
- }
1968
- this.destroyed = true;
1969
- this.updatePlayStopParams();
1970
- this.reportPlayStop();
1971
1979
  this.clearPlayingInterval();
1972
1980
  this.clearStallTimer();
1981
+ this.clearPlayResultTimer();
1973
1982
  clearTimeout(this.collectDownloadSpeedTimer);
1974
- this.removeWindowListener();
1983
+ };
1984
+ _proto2.handleUserLeave = function handleUserLeave() {
1985
+ try {
1986
+ var _this15 = this;
1987
+ if (_this15.destroyed || !_this15.started) {
1988
+ return Promise.resolve();
1989
+ }
1990
+ _this15.destroyed = true;
1991
+ return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
1992
+ _this15.reportPlayStop();
1993
+ _this15.clearPlayingInterval();
1994
+ _this15.clearStallTimer();
1995
+ clearTimeout(_this15.collectDownloadSpeedTimer);
1996
+ _this15.removeWindowListener();
1997
+ });
1998
+ } catch (e3) {
1999
+ return Promise.reject(e3);
2000
+ }
1975
2001
  };
1976
2002
  _proto2.saveBuffered = function saveBuffered() {
1977
2003
  try {
@@ -1994,8 +2020,10 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1994
2020
  }
1995
2021
  };
1996
2022
  _proto2.reportPlayStop = function reportPlayStop() {
1997
- this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
1998
- this.saveBuffered();
2023
+ if (this.player) {
2024
+ this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
2025
+ this.saveBuffered();
2026
+ }
1999
2027
  this.logmanager.push(this.log.play_stop, true);
2000
2028
  };
2001
2029
  _proto2.reportFirstframe = function reportFirstframe() {
@@ -2003,7 +2031,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
2003
2031
  return;
2004
2032
  }
2005
2033
  if (this.core) {
2006
- var _ref3 = this.core.getStats() || {}, fps = _ref3.fps;
2034
+ var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
2007
2035
  this.commonParams.fps = fps;
2008
2036
  }
2009
2037
  this.firstFrameViewed = true;
@@ -2022,47 +2050,79 @@ var XgLiveLogger = /* @__PURE__ */ function() {
2022
2050
  this.log.play_stop.is_stream_received = 1;
2023
2051
  };
2024
2052
  _proto2.updatePlayStopParams = function updatePlayStopParams() {
2025
- var timing = getResourceTiming(this._url);
2026
- var endTime = getCurrentTime();
2027
- this.playedTime = endTime - this.log.start_play.start_play_time;
2028
- var play_stop = this.log.play_stop;
2029
- Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
2030
- stall_time: 0
2031
- }));
2032
- if (this.inWaitingStart && endTime - this.inWaitingStart > 200) {
2033
- play_stop.stall_time += endTime - this.inWaitingStart;
2034
- }
2035
- this.inWaitingStart = 0;
2036
- Object.assign(play_stop, _objectSpread2({
2037
- stall_time_per_100sec: play_stop.stall_time / this.playedTime * 100,
2038
- // 计算百秒卡顿时长
2039
- stall_count_per_100sec: play_stop.stall_count * 1e3 / this.playedTime * 100
2040
- }, timing));
2041
- if (this.log.play_stop.stall_count_per_100sec === 0) {
2042
- this.log.play_stop.stall_time_per_100sec = 0;
2043
- }
2044
- if (this.log.play_stop.stall_time_per_100sec > 100 || this.log.play_stop.stall_time_per_100sec < 0) {
2045
- return;
2046
- }
2047
- if (this.log.playing.index) {
2048
- Object.assign(this.log.playing, _objectSpread2({
2049
- timestamp: getCurrentTime(),
2050
- is_last: 1
2051
- }, this.videoSize));
2052
- this.logmanager.push(this.log.playing, true);
2053
- } else {
2054
- this.log.play_stop.error_code = this.log.play_error.code;
2055
- this.log.play_stop.error_info = this.log.play_error.info;
2056
- }
2057
- endTime = getCurrentTime();
2058
- Object.assign(play_stop, _objectSpread2({
2059
- timestamp: endTime,
2060
- stop_time: endTime,
2061
- duration: this.playedTime / 1e3,
2062
- play_time: this.playedTime / 1e3
2063
- }, this.videoSize));
2064
- if (this.errorNumber === 0) {
2065
- play_stop.play_time_on_no_frame = play_stop.stop_time - this.log.start_play.start_play_time;
2053
+ try {
2054
+ var _this17$core;
2055
+ var _temp9 = function _temp92() {
2056
+ Object.assign(play_stop, _objectSpread2({
2057
+ timestamp: endTime,
2058
+ stop_time: endTime,
2059
+ duration: _this17.playedTime / 1e3,
2060
+ play_time: _this17.playedTime / 1e3
2061
+ }, _this17.videoSize));
2062
+ if (_this17.errorNumber === 0) {
2063
+ play_stop.play_time_on_no_frame = play_stop.stop_time - _this17.log.start_play.start_play_time;
2064
+ }
2065
+ };
2066
+ var _this17 = this;
2067
+ var timing = getResourceTiming(_this17._url);
2068
+ var endTime = getCurrentTime();
2069
+ _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
2070
+ var play_stop = _this17.log.play_stop;
2071
+ Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
2072
+ stall_time: 0
2073
+ }));
2074
+ if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
2075
+ play_stop.stall_time += endTime - _this17.inWaitingStart;
2076
+ }
2077
+ _this17.inWaitingStart = 0;
2078
+ Object.assign(play_stop, _objectSpread2({
2079
+ stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
2080
+ // 计算百秒卡顿时长
2081
+ stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
2082
+ }, timing));
2083
+ if (_this17.log.play_stop.stall_count_per_100sec === 0) {
2084
+ _this17.log.play_stop.stall_time_per_100sec = 0;
2085
+ }
2086
+ if (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
2087
+ return Promise.resolve();
2088
+ }
2089
+ if (_this17.log.playing.index) {
2090
+ Object.assign(_this17.log.playing, _objectSpread2({
2091
+ timestamp: getCurrentTime(),
2092
+ is_last: 1
2093
+ }, _this17.videoSize));
2094
+ _this17.logmanager.push(_this17.log.playing, true);
2095
+ } else {
2096
+ _this17.log.play_stop.error_code = _this17.log.play_error.code;
2097
+ _this17.log.play_stop.error_info = _this17.log.play_error.info;
2098
+ }
2099
+ endTime = getCurrentTime();
2100
+ if ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
2101
+ var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
2102
+ Object.assign(_this17.log.play_stop, {
2103
+ totalReceivedByte,
2104
+ totalReceivedCost,
2105
+ totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
2106
+ // bps
2107
+ });
2108
+ }
2109
+ var _temp10 = function() {
2110
+ var _this17$core2;
2111
+ if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
2112
+ return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
2113
+ var video = _ref8.video;
2114
+ var _ref9 = video || {}, packetsLost = _ref9.packetsLost, packetsReceived = _ref9.packetsReceived;
2115
+ Object.assign(play_stop, {
2116
+ packetsLost,
2117
+ packetsReceived,
2118
+ totalLostRate: packetsLost / (packetsLost + packetsReceived)
2119
+ });
2120
+ });
2121
+ }
2122
+ }();
2123
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
2124
+ } catch (e3) {
2125
+ return Promise.reject(e3);
2066
2126
  }
2067
2127
  };
2068
2128
  _proto2.clearPlayingInterval = function clearPlayingInterval() {
@@ -2931,8 +2991,8 @@ class Logger extends Plugin$2 {
2931
2991
  device_id: this._deviceId,
2932
2992
  ext: {
2933
2993
  veplayer_version: "2.3.1-rc.0",
2934
- flv_version: "3.0.18-alpha.5",
2935
- hls_version: "3.0.17",
2994
+ flv_version: "3.0.19-rc.0",
2995
+ hls_version: "3.0.19-rc.0",
2936
2996
  rts_version: "0.2.1-alpha.0"
2937
2997
  }
2938
2998
  });
@@ -3267,8 +3327,9 @@ const load$1 = window["VePlayer"].load;
3267
3327
  const getAbrStrategy = async (options) => {
3268
3328
  var _a, _b;
3269
3329
  const streamType = options.url && getStreamType(options.url);
3270
- if (streamType === "rtm")
3330
+ if (streamType === "rtm") {
3271
3331
  return {};
3332
+ }
3272
3333
  const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
3273
3334
  if (!abrOptions) {
3274
3335
  return {};
@@ -3319,6 +3380,23 @@ class VePlayerLive extends VePlayerBase {
3319
3380
  constructor(options) {
3320
3381
  super(options);
3321
3382
  }
3383
+ /** {zh}
3384
+ * @brief 获取已经播放的时间
3385
+ */
3386
+ get playTime() {
3387
+ var _a, _b, _c, _d;
3388
+ if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
3389
+ return 0;
3390
+ }
3391
+ const length = this._player.played.length;
3392
+ let time = 0;
3393
+ for (let index = 0; index < length; index++) {
3394
+ const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
3395
+ const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
3396
+ time += end - start;
3397
+ }
3398
+ return time;
3399
+ }
3322
3400
  /** {zh}
3323
3401
  * @brief 调用此方法开启直播日志上报。
3324
3402
  */
@@ -3361,13 +3439,33 @@ class VePlayerLive extends VePlayerBase {
3361
3439
  var _a;
3362
3440
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
3363
3441
  }
3442
+ /** {zh}
3443
+ * @brief 打开 Abr
3444
+ */
3364
3445
  openAbr() {
3365
- var _a, _b;
3366
- (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
3446
+ var _a, _b, _c, _d;
3447
+ const streamType = this.url && getStreamType(this.url);
3448
+ if (streamType === "flv") {
3449
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
3450
+ return;
3451
+ }
3452
+ if (streamType === "hls") {
3453
+ (_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(true);
3454
+ }
3367
3455
  }
3456
+ /** {zh}
3457
+ * @brief 关闭 Abr
3458
+ */
3368
3459
  closeAbr() {
3369
- var _a, _b;
3370
- (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
3460
+ var _a, _b, _c, _d;
3461
+ const streamType = this.url && getStreamType(this.url);
3462
+ if (streamType === "flv") {
3463
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
3464
+ return;
3465
+ }
3466
+ if (streamType === "hls") {
3467
+ (_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(false);
3468
+ }
3371
3469
  }
3372
3470
  /** {zh}
3373
3471
  * @brief 调用此方法更新 DRM 鉴权配置。
@@ -3377,56 +3475,48 @@ class VePlayerLive extends VePlayerBase {
3377
3475
  var _a, _b, _c;
3378
3476
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3379
3477
  }
3380
- switchAbr({ enable, bitrate }) {
3478
+ /** {zh}
3479
+ * @brief 切换 flv Abr
3480
+ * @param options 切换 Abr 的配置。
3481
+ * @returns
3482
+ */
3483
+ switchAbr(options) {
3381
3484
  var _a, _b;
3382
3485
  if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
3383
3486
  return;
3384
3487
  }
3385
- if (typeof bitrate !== "undefined") {
3386
- const url = this._player.plugins.abr.config.urls[bitrate];
3488
+ if (typeof (options == null ? void 0 : options.bitrate) !== "undefined") {
3489
+ const url = this._player.plugins.abr.config.urls[options.bitrate];
3387
3490
  if (!url) {
3388
3491
  return;
3389
3492
  }
3390
3493
  this.switch(url, { seamless: true });
3391
- this._player.plugins.abr.bitrate = bitrate;
3494
+ this._player.plugins.abr.bitrate = options.bitrate;
3392
3495
  }
3393
- if (typeof enable !== "undefined") {
3394
- (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(enable);
3496
+ if (typeof (options == null ? void 0 : options.enable) !== "undefined") {
3497
+ (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(options.enable);
3395
3498
  }
3396
3499
  }
3397
- async switch(target, options) {
3398
- var _a, _b, _c;
3399
- const { abr, ...rest } = options ?? {};
3400
- if (abr) {
3401
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
3402
- }
3403
- return super.switch(target, rest);
3404
- }
3405
- getPlayTime() {
3406
- var _a, _b, _c, _d;
3407
- if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
3408
- return 0;
3409
- }
3410
- const length = this._player.played.length;
3411
- let time = 0;
3412
- for (let index = 0; index < length; index++) {
3413
- const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
3414
- const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
3415
- time += end - start;
3416
- }
3417
- return time;
3418
- }
3419
- getPlayerVersion() {
3420
- return "2.3.1-rc.0";
3421
- }
3500
+ /** {zh}
3501
+ * @brief 获取 RTM 的网络相关信息
3502
+ * @returns
3503
+ */
3422
3504
  getRTMNetWorkInfo() {
3423
3505
  var _a, _b, _c;
3424
3506
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
3425
3507
  }
3508
+ /** {zh}
3509
+ * @brief 获取 RTM 播放信息
3510
+ * @returns
3511
+ */
3426
3512
  async getRTMStats() {
3427
- var _a;
3428
- return (_a = this._player) == null ? void 0 : _a.plugins.rts.getStatsSnapshoot();
3513
+ var _a, _b, _c;
3514
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot();
3429
3515
  }
3516
+ /** {zh}
3517
+ * @brief 获取 FLV 播放信息
3518
+ * @returns
3519
+ */
3430
3520
  getFLVStats() {
3431
3521
  var _a, _b, _c;
3432
3522
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();