@volcengine/veplayer 1.20.0-rc.3 → 1.20.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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [火山引擎视频云](https://www.volcengine.com/)Web播放器SDK,自动适配PC和H5场景,支持MP4、HLS、FLV、DASH等多种格式的点播和直播,结合视频云具有播放质量日志上报、加密播放等功能。
4
4
 
5
5
  ### 引入依赖
6
- 通过包管理工具将 SDK 的依赖安装到项目中。
6
+ 通过包管理工具将 SDK的依赖安装到项目中。
7
7
  ```bash
8
8
  npm install @volcengine/veplayer --save
9
9
  ```
package/index.d.ts CHANGED
@@ -3350,6 +3350,15 @@ export interface IGetPlayInfoRes {
3350
3350
  * 短剧环境配置接口
3351
3351
  */
3352
3352
  export interface ITTDramaEnv {
3353
+ /** {zh}
3354
+ * @brief 首次 TTMinis.init 调用的 Unix 毫秒时间,用于计算首个视频的起播耗时。
3355
+ * @hidden
3356
+ */
3357
+ /** {en}
3358
+ * @brief Unix timestamp in milliseconds of the first TTMinis.init call, used for first-video startup duration.
3359
+ * @hidden
3360
+ */
3361
+ pageLoadStartTime?: number;
3353
3362
  /** 云服务商,默认从构建时 env.__PLATFORM__ 获取,未注入时默认为 byteplus */
3354
3363
  channel?: "volcengine" | "byteplus";
3355
3364
  /**
@@ -3385,6 +3394,19 @@ export interface ITTDramaEnv {
3385
3394
  * @type {function}
3386
3395
  */
3387
3396
  sendLog: (EventName: string, params: Record<string, any>) => void;
3397
+ /** {zh}
3398
+ * @hidden
3399
+ * @brief 当前在播短剧身份变化通知,由宿主集成层消费。
3400
+ */
3401
+ /** {en}
3402
+ * @hidden
3403
+ * @brief Notifies the host integration when the current drama playback identity changes.
3404
+ */
3405
+ onCurrentDramaPlaybackContextChange?: (context: {
3406
+ albumId: string | null;
3407
+ episodeId: string | null;
3408
+ vid: string | null;
3409
+ } | null) => boolean | void;
3388
3410
  /**
3389
3411
  * 低版本 app 下验证 TTOP 签发的 playAuthToken 时使用的密钥
3390
3412
  * 通过 JSB(如 minis.getSecret)从 Native 获取,用于 HMAC-SHA256 签名校验
@@ -3433,18 +3455,35 @@ export interface IGetDramaInfoPerfInfo {
3433
3455
  * JSB 获取短剧信息返回结果
3434
3456
  */
3435
3457
  export interface IJSBCallbackResult {
3458
+ /** {zh} @brief 旧回包的顶层 Native 通参;优先使用 data.tracking_context。 */
3459
+ /** {en} @brief Legacy top-level tracking fields; data.tracking_context takes priority. */
3460
+ tracking_context?: {
3461
+ enter_from?: string;
3462
+ minis_type?: string;
3463
+ minis_id?: string;
3464
+ ttoclid?: string;
3465
+ };
3436
3466
  is_success: number | boolean;
3437
3467
  error?: MinisError;
3438
3468
  data?: {
3469
+ /** {zh} @brief Native 埋点通参;缺失时不报对应字段。 */
3470
+ /** {en} @brief Native tracking fields; omitted fields are not reported. */
3471
+ tracking_context?: IJSBCallbackResult["tracking_context"];
3439
3472
  status: number;
3440
3473
  drama_info: {
3441
- album_id: string;
3442
- drama_name: string;
3443
- drama_cover: string;
3444
- drama_description: string;
3474
+ drama_id?: string;
3475
+ album_id?: string;
3476
+ album_name?: string;
3477
+ episode_total_num?: number;
3478
+ drama_name?: string;
3479
+ album_cover?: string;
3480
+ drama_cover?: string;
3481
+ album_description?: string;
3482
+ drama_description?: string;
3445
3483
  };
3446
3484
  episode_info: {
3447
3485
  episode_id: string;
3486
+ episode_current_num?: number;
3448
3487
  episode_name: string;
3449
3488
  episode_cover: string;
3450
3489
  episode_description: string;
@@ -7089,6 +7128,7 @@ export declare const enum LangTextKey {
7089
7128
  NETWORK_URL_EXPIRE = "NETWORK_URL_EXPIRE",
7090
7129
  NETWORK_URL_SIGN = "NETWORK_URL_SIGN",
7091
7130
  NETWORK_ENCRYPT_HLS_ERR = "NETWORK_ENCRYPT_HLS_ERR",
7131
+ DECODER_INIT_NOT_SUPPORTED = "DECODER_INIT_NOT_SUPPORTED",
7092
7132
  MEDIA_ERR = "MEDIA_ERR",
7093
7133
  MEDIA_ERR_ABORTED = "MEDIA_ERR_ABORTED",
7094
7134
  MEDIA_ERR_NETWORK = "MEDIA_ERR_NETWORK",
@@ -7141,6 +7181,8 @@ export declare const enum LangTextKey {
7141
7181
  DRAMA_FAILED_TO_QUERY = "DRAMA_FAILED_TO_QUERY",
7142
7182
  DRAMA_INVALID_TTOP_TOKEN = "DRAMA_INVALID_TTOP_TOKEN",
7143
7183
  DRAMA_NOT_ON_SHELF = "DRAMA_NOT_ON_SHELF",
7184
+ DRAMA_EMPTY_PLAYLIST = "DRAMA_EMPTY_PLAYLIST",
7185
+ DRAMA_GET_INFO_TIMEOUT = "DRAMA_GET_INFO_TIMEOUT",
7144
7186
  DRAMA_FAILED_GET_EPISODE_INFO = "DRAMA_FAILED_GET_EPISODE_INFO"
7145
7187
  }
7146
7188
  declare const DRAMA_ERROR_CODE: {
@@ -7190,6 +7232,16 @@ declare const DRAMA_ERROR_CODE: {
7190
7232
  readonly message: "Video is not on shelf";
7191
7233
  readonly textKey: LangTextKey.DRAMA_NOT_ON_SHELF;
7192
7234
  };
7235
+ readonly EMPTY_PLAYLIST: {
7236
+ readonly code: 9311;
7237
+ readonly message: "Episode video playlist is empty";
7238
+ readonly textKey: LangTextKey.DRAMA_EMPTY_PLAYLIST;
7239
+ };
7240
+ readonly GET_INFO_TIMEOUT: {
7241
+ readonly code: 9312;
7242
+ readonly message: "getDramaInfo request timed out";
7243
+ readonly textKey: LangTextKey.DRAMA_GET_INFO_TIMEOUT;
7244
+ };
7193
7245
  readonly FAILED_GET_EPISODE_INFO: {
7194
7246
  readonly code: 9399;
7195
7247
  readonly message: "Failed get episode info";
@@ -7211,17 +7263,20 @@ declare class AuthToken extends SdkPlugin {
7211
7263
  playInfo?: VideoInfoRes;
7212
7264
  constructor(args: any);
7213
7265
  beforePlayerCreate(): Promise<void>;
7214
- getVideoInfo(sourceConfigs?: IPlayerConfig): Promise<{
7266
+ getVideoInfo(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<{
7215
7267
  vid: string;
7216
7268
  __mediaInfoCacheHit: boolean;
7269
+ __serverFetchDuration: number;
7270
+ __dramaTrackingContext: Record<string, unknown>;
7217
7271
  playList: Stream[];
7218
7272
  codec: ICodecType;
7219
7273
  defaultDefinition: string;
7220
7274
  }>;
7275
+ private reportEmptyDramaPlaylist;
7221
7276
  /**
7222
7277
  * 短剧 Minis 环境:通过 JSB getDramaInfo 获取媒体信息
7223
7278
  */
7224
- getDramaInfoViaJSB(sourceConfigs?: IPlayerConfig): Promise<VideoInfoRes | undefined>;
7279
+ getDramaInfoViaJSB(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<VideoInfoRes | undefined>;
7225
7280
  /**
7226
7281
  * 将审核状态映射到短剧错误码
7227
7282
  */
@@ -7240,7 +7295,7 @@ declare class AuthToken extends SdkPlugin {
7240
7295
  episodeId?: string;
7241
7296
  vid?: string;
7242
7297
  }): void;
7243
- getVideos(sourceConfigs?: IPlayerConfig): Promise<any>;
7298
+ getVideos(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<any>;
7244
7299
  getPrivateDrmInfo(playList: Stream[], vid: string, streamType: string): Promise<void>;
7245
7300
  getThumbnailConfig(thumbs: IThumbInfoItem[]): void;
7246
7301
  getBarrageMaskUrl(url: string): void;
@@ -7261,16 +7316,16 @@ declare class AuthToken extends SdkPlugin {
7261
7316
  /**
7262
7317
  * 剧集切换:configs 已由 player 更新 album_id/episode_id,重新拉取媒体信息
7263
7318
  */
7264
- updateDramaEpisode(isNewVideo: boolean, candidateConfig?: IPlayerConfig): Promise<void>;
7319
+ updateDramaEpisode(isNewVideo: boolean, candidateConfig?: IPlayerConfig, errors?: any[]): Promise<void>;
7265
7320
  /**
7266
7321
  * @description 更新playAuthToken
7267
7322
  * @param {IPlayAuthTokenConfig} getVideoByToken token信息
7268
7323
  * @param {boolean} isNewVideo 是否新视频,即是否为切换视频
7269
7324
  */
7270
7325
  updateAuthToken(getVideoByToken: IPlayAuthTokenConfig, isNewVideo: boolean): Promise<void>;
7271
- checkPlayAuthTokenValid(): boolean;
7272
- checkKeyTokenValid(): boolean;
7273
- checkDrmAuthTokenValid(): boolean;
7326
+ checkPlayAuthTokenValid(errors?: any[]): boolean;
7327
+ checkKeyTokenValid(errors?: any[]): boolean;
7328
+ checkDrmAuthTokenValid(errors?: any[]): boolean;
7274
7329
  }
7275
7330
  /** {zh}
7276
7331
  * @hidden
@@ -7650,7 +7705,7 @@ declare class PlayerData {
7650
7705
  /**
7651
7706
  * @description: 获取当前的streamType
7652
7707
  */
7653
- getCurrentStreamType(): string;
7708
+ getCurrentStreamType(fallback?: string): string;
7654
7709
  getStreamType(): string;
7655
7710
  getConfiguredHlsAbrEngine(): HlsAbrEngine;
7656
7711
  isOpenVePlayerABR(): boolean;
@@ -8411,6 +8466,7 @@ declare function getMediaInfoCacheConfig(): NormalizedMediaInfoCacheConfig;
8411
8466
  export interface DramaIdentity {
8412
8467
  albumId: string | null;
8413
8468
  episodeId: string | null;
8469
+ vid: string | null;
8414
8470
  }
8415
8471
  export declare type PlayerPlaybackState = "creating" | "ready" | "playing" | "paused" | "buffering" | "ended" | "error" | "destroyed";
8416
8472
  export interface PlayerPlaybackStateSnapshot extends DramaIdentity {
@@ -8744,6 +8800,23 @@ declare class VePlayer {
8744
8800
  * ```
8745
8801
  */
8746
8802
  static prefetchMediaInfo(sources: IMediaInfoPrefetchSource[]): Promise<IMediaInfoPrefetchResult[]>;
8803
+ /** {zh}
8804
+ * @brief 全局设置是否为 MSE 媒体请求添加 x-tt-trace-id,默认关闭。
8805
+ * @param enable - 是否开启。新建播放器或下一次 playNext 时生效,当前播放保持原设置。
8806
+ * @notes 开启前需确保 CDN 的 CORS 配置允许 x-tt-trace-id。独立预加载不添加该请求头。
8807
+ * @example
8808
+ * VePlayer.setMediaTraceEnabled(true);
8809
+ * @list Api
8810
+ */
8811
+ /** {en}
8812
+ * @brief Globally enable x-tt-trace-id on MSE media requests. Disabled by default.
8813
+ * @param enable - Applies to new players and the next playNext; the current playback is unchanged.
8814
+ * @notes The CDN must allow x-tt-trace-id in CORS. Independent preloads do not include this header.
8815
+ * @example
8816
+ * VePlayer.setMediaTraceEnabled(true);
8817
+ * @list Api
8818
+ */
8819
+ static setMediaTraceEnabled(enable: boolean): void;
8747
8820
  /** {zh}
8748
8821
  * @brief 设置全局日志开关。开启后会输出 VE_DEBUG.log 级别日志。
8749
8822
  * @param enable 是否开启详细日志
@@ -9301,6 +9374,7 @@ declare class VePlayer {
9301
9374
  * @memberof VePlayer
9302
9375
  */
9303
9376
  updateAuthToken(config: IPlayAuthTokenConfig): Promise<void>;
9377
+ private _finishMediaPreparation;
9304
9378
  private _playerPlayNext;
9305
9379
  /** {zh}
9306
9380
  * @brief 返回当前视频的地址。
@@ -9380,6 +9454,7 @@ declare class VePlayer {
9380
9454
  private _buildDramaInvalidParamError;
9381
9455
  private _getDramaAlbumIdFromConfig;
9382
9456
  private _getDramaEpisodeIdFromConfig;
9457
+ private _reportPlayNextFailure;
9383
9458
  private switchDramaEpisode;
9384
9459
  /** {zh}
9385
9460
  * @brief 销毁xgplayer实例