@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.4.0-rc.3",
3
+ "version": "2.4.0-rc.5",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
package/umd/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;
@@ -887,7 +887,7 @@ var __publicField = (obj, key, value) => {
887
887
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
888
888
  player_sdk_version: player.version,
889
889
  // eslint-disable-next-line no-undef
890
- logger_version: "1.1.0-alpha.7",
890
+ logger_version: "1.1.0-alpha.10",
891
891
  // 由rollup 在编译时注入
892
892
  report_version: "5",
893
893
  product_line: options.product_line,
@@ -1691,9 +1691,29 @@ var __publicField = (obj, key, value) => {
1691
1691
  play_current_time: _this7.player.currentTime
1692
1692
  }, _this7.videoSize));
1693
1693
  return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
1694
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2({
1694
+ var flvStats = {};
1695
+ if (_this7.core) {
1696
+ if (_this7.core.getStats) {
1697
+ var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
1698
+ Object.assign(flvStats, {
1699
+ bitrate,
1700
+ avg_speed: avgSpeed,
1701
+ rate: avgSpeed / bitrate
1702
+ });
1703
+ }
1704
+ if (_this7.core.getNetWorkInfo) {
1705
+ var _this7$core$core;
1706
+ var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
1707
+ var _ref4 = ((_this7$core$core = _this7.core.core) === null || _this7$core$core === void 0 ? void 0 : _this7$core$core._opts) || {}, networkEvaluateInterval = _ref4.networkEvaluateInterval;
1708
+ Object.assign(flvStats, {
1709
+ lostRate,
1710
+ networkEvaluateInterval
1711
+ });
1712
+ }
1713
+ }
1714
+ _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
1695
1715
  play_time: first ? 0 : playedTime
1696
- }, stats)), true);
1716
+ }, stats), flvStats)), true);
1697
1717
  _this7.log.playing.download_speed_array = [];
1698
1718
  _this7.log.playing.stall_time = 0;
1699
1719
  _this7.log.playing.stall_count = 0;
@@ -1714,7 +1734,7 @@ var __publicField = (obj, key, value) => {
1714
1734
  _this9.player.off("playing", _this9.handlePlayerPlaying);
1715
1735
  _this9.player.off("timeupdate", _this9.handlePlayerPlaying);
1716
1736
  if (_this9.core) {
1717
- var _ref2 = _this9.core.getStats() || {}, fps = _ref2.fps;
1737
+ var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
1718
1738
  _this9.commonParams.fps = fps;
1719
1739
  }
1720
1740
  return Promise.resolve(_this9.reportPlaying(true)).then(function() {
@@ -1725,7 +1745,7 @@ var __publicField = (obj, key, value) => {
1725
1745
  var _temp4 = function() {
1726
1746
  if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
1727
1747
  var _temp5 = function() {
1728
- if (!_this9.player.video) {
1748
+ if (!_this9.player || !_this9.player.video) {
1729
1749
  _this9.destroyFunc();
1730
1750
  } else {
1731
1751
  var _temp6 = function() {
@@ -1958,24 +1978,30 @@ var __publicField = (obj, key, value) => {
1958
1978
  this.player.off("bufferappend", this.handleBufferAppend);
1959
1979
  this.player.off("core_event", this.handleCoreEvent);
1960
1980
  this.player.off("degrade", this.handleDegrade);
1961
- this.clearPlayingInterval();
1962
- this.clearStallTimer();
1963
- this.clearPlayResultTimer();
1964
- clearTimeout(this.collectDownloadSpeedTimer);
1965
1981
  this._player = null;
1966
1982
  }
1967
- };
1968
- _proto2.handleUserLeave = function handleUserLeave() {
1969
- if (this.destroyed || !this.started) {
1970
- return;
1971
- }
1972
- this.destroyed = true;
1973
- this.updatePlayStopParams();
1974
- this.reportPlayStop();
1975
1983
  this.clearPlayingInterval();
1976
1984
  this.clearStallTimer();
1985
+ this.clearPlayResultTimer();
1977
1986
  clearTimeout(this.collectDownloadSpeedTimer);
1978
- this.removeWindowListener();
1987
+ };
1988
+ _proto2.handleUserLeave = function handleUserLeave() {
1989
+ try {
1990
+ var _this15 = this;
1991
+ if (_this15.destroyed || !_this15.started) {
1992
+ return Promise.resolve();
1993
+ }
1994
+ _this15.destroyed = true;
1995
+ return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
1996
+ _this15.reportPlayStop();
1997
+ _this15.clearPlayingInterval();
1998
+ _this15.clearStallTimer();
1999
+ clearTimeout(_this15.collectDownloadSpeedTimer);
2000
+ _this15.removeWindowListener();
2001
+ });
2002
+ } catch (e2) {
2003
+ return Promise.reject(e2);
2004
+ }
1979
2005
  };
1980
2006
  _proto2.saveBuffered = function saveBuffered() {
1981
2007
  try {
@@ -1998,8 +2024,10 @@ var __publicField = (obj, key, value) => {
1998
2024
  }
1999
2025
  };
2000
2026
  _proto2.reportPlayStop = function reportPlayStop() {
2001
- this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
2002
- this.saveBuffered();
2027
+ if (this.player) {
2028
+ this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
2029
+ this.saveBuffered();
2030
+ }
2003
2031
  this.logmanager.push(this.log.play_stop, true);
2004
2032
  };
2005
2033
  _proto2.reportFirstframe = function reportFirstframe() {
@@ -2007,7 +2035,7 @@ var __publicField = (obj, key, value) => {
2007
2035
  return;
2008
2036
  }
2009
2037
  if (this.core) {
2010
- var _ref3 = this.core.getStats() || {}, fps = _ref3.fps;
2038
+ var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
2011
2039
  this.commonParams.fps = fps;
2012
2040
  }
2013
2041
  this.firstFrameViewed = true;
@@ -2026,47 +2054,79 @@ var __publicField = (obj, key, value) => {
2026
2054
  this.log.play_stop.is_stream_received = 1;
2027
2055
  };
2028
2056
  _proto2.updatePlayStopParams = function updatePlayStopParams() {
2029
- var timing = getResourceTiming(this._url);
2030
- var endTime = getCurrentTime();
2031
- this.playedTime = endTime - this.log.start_play.start_play_time;
2032
- var play_stop = this.log.play_stop;
2033
- Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
2034
- stall_time: 0
2035
- }));
2036
- if (this.inWaitingStart && endTime - this.inWaitingStart > 200) {
2037
- play_stop.stall_time += endTime - this.inWaitingStart;
2038
- }
2039
- this.inWaitingStart = 0;
2040
- Object.assign(play_stop, _objectSpread2({
2041
- stall_time_per_100sec: play_stop.stall_time / this.playedTime * 100,
2042
- // 计算百秒卡顿时长
2043
- stall_count_per_100sec: play_stop.stall_count * 1e3 / this.playedTime * 100
2044
- }, timing));
2045
- if (this.log.play_stop.stall_count_per_100sec === 0) {
2046
- this.log.play_stop.stall_time_per_100sec = 0;
2047
- }
2048
- if (this.log.play_stop.stall_time_per_100sec > 100 || this.log.play_stop.stall_time_per_100sec < 0) {
2049
- return;
2050
- }
2051
- if (this.log.playing.index) {
2052
- Object.assign(this.log.playing, _objectSpread2({
2053
- timestamp: getCurrentTime(),
2054
- is_last: 1
2055
- }, this.videoSize));
2056
- this.logmanager.push(this.log.playing, true);
2057
- } else {
2058
- this.log.play_stop.error_code = this.log.play_error.code;
2059
- this.log.play_stop.error_info = this.log.play_error.info;
2060
- }
2061
- endTime = getCurrentTime();
2062
- Object.assign(play_stop, _objectSpread2({
2063
- timestamp: endTime,
2064
- stop_time: endTime,
2065
- duration: this.playedTime / 1e3,
2066
- play_time: this.playedTime / 1e3
2067
- }, this.videoSize));
2068
- if (this.errorNumber === 0) {
2069
- play_stop.play_time_on_no_frame = play_stop.stop_time - this.log.start_play.start_play_time;
2057
+ try {
2058
+ var _this17$core;
2059
+ var _temp9 = function _temp92() {
2060
+ Object.assign(play_stop, _objectSpread2({
2061
+ timestamp: endTime,
2062
+ stop_time: endTime,
2063
+ duration: _this17.playedTime / 1e3,
2064
+ play_time: _this17.playedTime / 1e3
2065
+ }, _this17.videoSize));
2066
+ if (_this17.errorNumber === 0) {
2067
+ play_stop.play_time_on_no_frame = play_stop.stop_time - _this17.log.start_play.start_play_time;
2068
+ }
2069
+ };
2070
+ var _this17 = this;
2071
+ var timing = getResourceTiming(_this17._url);
2072
+ var endTime = getCurrentTime();
2073
+ _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
2074
+ var play_stop = _this17.log.play_stop;
2075
+ Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
2076
+ stall_time: 0
2077
+ }));
2078
+ if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
2079
+ play_stop.stall_time += endTime - _this17.inWaitingStart;
2080
+ }
2081
+ _this17.inWaitingStart = 0;
2082
+ Object.assign(play_stop, _objectSpread2({
2083
+ stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
2084
+ // 计算百秒卡顿时长
2085
+ stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
2086
+ }, timing));
2087
+ if (_this17.log.play_stop.stall_count_per_100sec === 0) {
2088
+ _this17.log.play_stop.stall_time_per_100sec = 0;
2089
+ }
2090
+ if (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
2091
+ return Promise.resolve();
2092
+ }
2093
+ if (_this17.log.playing.index) {
2094
+ Object.assign(_this17.log.playing, _objectSpread2({
2095
+ timestamp: getCurrentTime(),
2096
+ is_last: 1
2097
+ }, _this17.videoSize));
2098
+ _this17.logmanager.push(_this17.log.playing, true);
2099
+ } else {
2100
+ _this17.log.play_stop.error_code = _this17.log.play_error.code;
2101
+ _this17.log.play_stop.error_info = _this17.log.play_error.info;
2102
+ }
2103
+ endTime = getCurrentTime();
2104
+ if ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
2105
+ var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
2106
+ Object.assign(_this17.log.play_stop, {
2107
+ totalReceivedByte,
2108
+ totalReceivedCost,
2109
+ totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
2110
+ // bps
2111
+ });
2112
+ }
2113
+ var _temp10 = function() {
2114
+ var _this17$core2;
2115
+ if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
2116
+ return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
2117
+ var video = _ref8.video;
2118
+ var _ref9 = video || {}, packetsLost = _ref9.packetsLost, packetsReceived = _ref9.packetsReceived;
2119
+ Object.assign(play_stop, {
2120
+ packetsLost,
2121
+ packetsReceived,
2122
+ totalLostRate: packetsLost / (packetsLost + packetsReceived)
2123
+ });
2124
+ });
2125
+ }
2126
+ }();
2127
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
2128
+ } catch (e2) {
2129
+ return Promise.reject(e2);
2070
2130
  }
2071
2131
  };
2072
2132
  _proto2.clearPlayingInterval = function clearPlayingInterval() {
@@ -2935,8 +2995,8 @@ var __publicField = (obj, key, value) => {
2935
2995
  device_id: this._deviceId,
2936
2996
  ext: {
2937
2997
  veplayer_version: "2.3.1-rc.0",
2938
- flv_version: "3.0.18-alpha.5",
2939
- hls_version: "3.0.17",
2998
+ flv_version: "3.0.19-rc.0",
2999
+ hls_version: "3.0.19-rc.0",
2940
3000
  rts_version: "0.2.1-alpha.0"
2941
3001
  }
2942
3002
  });
@@ -3271,8 +3331,9 @@ var __publicField = (obj, key, value) => {
3271
3331
  const getAbrStrategy = async (options) => {
3272
3332
  var _a, _b;
3273
3333
  const streamType = options.url && getStreamType(options.url);
3274
- if (streamType === "rtm")
3334
+ if (streamType === "rtm") {
3275
3335
  return {};
3336
+ }
3276
3337
  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;
3277
3338
  if (!abrOptions) {
3278
3339
  return {};
@@ -3323,6 +3384,23 @@ var __publicField = (obj, key, value) => {
3323
3384
  constructor(options) {
3324
3385
  super(options);
3325
3386
  }
3387
+ /** {zh}
3388
+ * @brief 获取已经播放的时间
3389
+ */
3390
+ get playTime() {
3391
+ var _a, _b, _c, _d;
3392
+ if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
3393
+ return 0;
3394
+ }
3395
+ const length = this._player.played.length;
3396
+ let time = 0;
3397
+ for (let index = 0; index < length; index++) {
3398
+ const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
3399
+ const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
3400
+ time += end - start;
3401
+ }
3402
+ return time;
3403
+ }
3326
3404
  /** {zh}
3327
3405
  * @brief 调用此方法开启直播日志上报。
3328
3406
  */
@@ -3365,13 +3443,33 @@ var __publicField = (obj, key, value) => {
3365
3443
  var _a;
3366
3444
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
3367
3445
  }
3446
+ /** {zh}
3447
+ * @brief 打开 Abr
3448
+ */
3368
3449
  openAbr() {
3369
- var _a, _b;
3370
- (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
3450
+ var _a, _b, _c, _d;
3451
+ const streamType = this.url && getStreamType(this.url);
3452
+ if (streamType === "flv") {
3453
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
3454
+ return;
3455
+ }
3456
+ if (streamType === "hls") {
3457
+ (_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(true);
3458
+ }
3371
3459
  }
3460
+ /** {zh}
3461
+ * @brief 关闭 Abr
3462
+ */
3372
3463
  closeAbr() {
3373
- var _a, _b;
3374
- (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
3464
+ var _a, _b, _c, _d;
3465
+ const streamType = this.url && getStreamType(this.url);
3466
+ if (streamType === "flv") {
3467
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
3468
+ return;
3469
+ }
3470
+ if (streamType === "hls") {
3471
+ (_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(false);
3472
+ }
3375
3473
  }
3376
3474
  /** {zh}
3377
3475
  * @brief 调用此方法更新 DRM 鉴权配置。
@@ -3381,56 +3479,48 @@ var __publicField = (obj, key, value) => {
3381
3479
  var _a, _b, _c;
3382
3480
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3383
3481
  }
3384
- switchAbr({ enable, bitrate }) {
3482
+ /** {zh}
3483
+ * @brief 切换 flv Abr
3484
+ * @param options 切换 Abr 的配置。
3485
+ * @returns
3486
+ */
3487
+ switchAbr(options) {
3385
3488
  var _a, _b;
3386
3489
  if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
3387
3490
  return;
3388
3491
  }
3389
- if (typeof bitrate !== "undefined") {
3390
- const url = this._player.plugins.abr.config.urls[bitrate];
3492
+ if (typeof (options == null ? void 0 : options.bitrate) !== "undefined") {
3493
+ const url = this._player.plugins.abr.config.urls[options.bitrate];
3391
3494
  if (!url) {
3392
3495
  return;
3393
3496
  }
3394
3497
  this.switch(url, { seamless: true });
3395
- this._player.plugins.abr.bitrate = bitrate;
3498
+ this._player.plugins.abr.bitrate = options.bitrate;
3396
3499
  }
3397
- if (typeof enable !== "undefined") {
3398
- (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(enable);
3500
+ if (typeof (options == null ? void 0 : options.enable) !== "undefined") {
3501
+ (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(options.enable);
3399
3502
  }
3400
3503
  }
3401
- async switch(target, options) {
3402
- var _a, _b, _c;
3403
- const { abr, ...rest } = options ?? {};
3404
- if (abr) {
3405
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
3406
- }
3407
- return super.switch(target, rest);
3408
- }
3409
- getPlayTime() {
3410
- var _a, _b, _c, _d;
3411
- if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
3412
- return 0;
3413
- }
3414
- const length = this._player.played.length;
3415
- let time = 0;
3416
- for (let index = 0; index < length; index++) {
3417
- const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
3418
- const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
3419
- time += end - start;
3420
- }
3421
- return time;
3422
- }
3423
- getPlayerVersion() {
3424
- return "2.3.1-rc.0";
3425
- }
3504
+ /** {zh}
3505
+ * @brief 获取 RTM 的网络相关信息
3506
+ * @returns
3507
+ */
3426
3508
  getRTMNetWorkInfo() {
3427
3509
  var _a, _b, _c;
3428
3510
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
3429
3511
  }
3512
+ /** {zh}
3513
+ * @brief 获取 RTM 播放信息
3514
+ * @returns
3515
+ */
3430
3516
  async getRTMStats() {
3431
- var _a;
3432
- return (_a = this._player) == null ? void 0 : _a.plugins.rts.getStatsSnapshoot();
3517
+ var _a, _b, _c;
3518
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot();
3433
3519
  }
3520
+ /** {zh}
3521
+ * @brief 获取 FLV 播放信息
3522
+ * @returns
3523
+ */
3434
3524
  getFLVStats() {
3435
3525
  var _a, _b, _c;
3436
3526
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();