@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.4.0-rc.0",
3
+ "version": "2.4.0-rc.2",
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
@@ -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 节点。
@@ -2935,9 +2935,9 @@ var __publicField = (obj, key, value) => {
2935
2935
  device_id: this._deviceId,
2936
2936
  ext: {
2937
2937
  veplayer_version: "2.3.1-rc.0",
2938
- flv_version: "3.0.17",
2938
+ flv_version: "3.0.18-alpha.3",
2939
2939
  hls_version: "3.0.17",
2940
- rts_version: "0.2.0-alpha.5"
2940
+ rts_version: "0.2.1-alpha.0"
2941
2941
  }
2942
2942
  });
2943
2943
  }
@@ -3280,7 +3280,10 @@ var __publicField = (obj, key, value) => {
3280
3280
  const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
3281
3281
  return {
3282
3282
  options: {
3283
- [streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
3283
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
3284
+ ...abrOptions,
3285
+ open: abrOptions.enable ?? true
3286
+ }
3284
3287
  },
3285
3288
  plugins: [
3286
3289
  streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
@@ -3378,6 +3381,23 @@ var __publicField = (obj, key, value) => {
3378
3381
  var _a, _b, _c;
3379
3382
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3380
3383
  }
3384
+ switchAbr({ enable, bitrate }) {
3385
+ var _a, _b;
3386
+ if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
3387
+ return;
3388
+ }
3389
+ if (typeof bitrate !== "undefined") {
3390
+ const url = this._player.plugins.abr.config.urls[bitrate];
3391
+ if (!url) {
3392
+ return;
3393
+ }
3394
+ this.switch(url, { seamless: true });
3395
+ this._player.plugins.abr.bitrate = bitrate;
3396
+ }
3397
+ if (typeof enable !== "undefined") {
3398
+ (_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(enable);
3399
+ }
3400
+ }
3381
3401
  async switch(target, options) {
3382
3402
  var _a, _b, _c;
3383
3403
  const { abr, ...rest } = options ?? {};
@@ -3386,6 +3406,31 @@ var __publicField = (obj, key, value) => {
3386
3406
  }
3387
3407
  return super.switch(target, rest);
3388
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
+ }
3426
+ getRTMNetWorkInfo() {
3427
+ var _a, _b, _c;
3428
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
3429
+ }
3430
+ getFLVStats() {
3431
+ var _a, _b, _c;
3432
+ return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
3433
+ }
3389
3434
  }
3390
3435
  async function createLivePlayer(options) {
3391
3436
  var _a, _b;