@volcengine/veplayer 2.4.0-rc.0 → 2.4.0-rc.2

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/esm/index.d.ts CHANGED
@@ -1851,6 +1851,7 @@ declare class VePlayerBase {
1851
1851
  *
1852
1852
  */
1853
1853
  fallbackToFirstDefinition?: boolean;
1854
+ seamless?: boolean;
1854
1855
  }): Promise<ExposedDefinition>;
1855
1856
  /** {zh}
1856
1857
  * @brief 调用此方法更新拉流地址列表。
@@ -2019,6 +2020,7 @@ declare class VePlayerBase {
2019
2020
  */
2020
2021
  ignorePaused?: boolean;
2021
2022
  }): void;
2023
+ canPlayType(type: string): boolean;
2022
2024
  /** {zh}
2023
2025
  * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
2024
2026
  * @param el 全屏作用的 DOM 节点。
@@ -2931,9 +2931,9 @@ class Logger extends Plugin$2 {
2931
2931
  device_id: this._deviceId,
2932
2932
  ext: {
2933
2933
  veplayer_version: "2.3.1-rc.0",
2934
- flv_version: "3.0.17",
2934
+ flv_version: "3.0.18-alpha.3",
2935
2935
  hls_version: "3.0.17",
2936
- rts_version: "0.2.0-alpha.5"
2936
+ rts_version: "0.2.1-alpha.0"
2937
2937
  }
2938
2938
  });
2939
2939
  }
@@ -3276,7 +3276,10 @@ const getAbrStrategy = async (options) => {
3276
3276
  const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
3277
3277
  return {
3278
3278
  options: {
3279
- [streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
3279
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
3280
+ ...abrOptions,
3281
+ open: abrOptions.enable ?? true
3282
+ }
3280
3283
  },
3281
3284
  plugins: [
3282
3285
  streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
@@ -3374,6 +3377,23 @@ class VePlayerLive extends VePlayerBase {
3374
3377
  var _a, _b, _c;
3375
3378
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3376
3379
  }
3380
+ switchAbr({ enable, bitrate }) {
3381
+ var _a, _b;
3382
+ if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
3383
+ return;
3384
+ }
3385
+ if (typeof bitrate !== "undefined") {
3386
+ const url = this._player.plugins.abr.config.urls[bitrate];
3387
+ if (!url) {
3388
+ return;
3389
+ }
3390
+ this.switch(url, { seamless: true });
3391
+ this._player.plugins.abr.bitrate = bitrate;
3392
+ }
3393
+ if (typeof enable !== "undefined") {
3394
+ (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(enable);
3395
+ }
3396
+ }
3377
3397
  async switch(target, options) {
3378
3398
  var _a, _b, _c;
3379
3399
  const { abr, ...rest } = options ?? {};
@@ -3382,6 +3402,31 @@ class VePlayerLive extends VePlayerBase {
3382
3402
  }
3383
3403
  return super.switch(target, rest);
3384
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
+ }
3422
+ getRTMNetWorkInfo() {
3423
+ var _a, _b, _c;
3424
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
3425
+ }
3426
+ getFLVStats() {
3427
+ var _a, _b, _c;
3428
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
3429
+ }
3385
3430
  }
3386
3431
  async function createLivePlayer(options) {
3387
3432
  var _a, _b;