@volcengine/veplayer 1.20.0-rc.0 → 1.20.0-rc.10

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/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,8 +3455,14 @@ export interface IGetDramaInfoPerfInfo {
3433
3455
  * JSB 获取短剧信息返回结果
3434
3456
  */
3435
3457
  export interface IJSBCallbackResult {
3436
- /** {zh} @brief 顶层 Native 通参;旧客户端可缺失。 */
3437
- /** {en} @brief Top-level Native tracking fields; absent on older clients. */
3458
+ /** {zh} @brief Native 请求诊断;未知字段省略。 @hidden */
3459
+ /** {en} @brief Native request diagnostics; unavailable fields are omitted. @hidden */
3460
+ request_diagnostics?: Record<string, unknown>;
3461
+ /** {zh} @brief 剧集接口请求标识,获取到时提供。 @hidden */
3462
+ /** {en} @brief Drama request log ID, when available. @hidden */
3463
+ log_id?: string;
3464
+ /** {zh} @brief 旧回包的顶层 Native 通参;优先使用 data.tracking_context。 */
3465
+ /** {en} @brief Legacy top-level tracking fields; data.tracking_context takes priority. */
3438
3466
  tracking_context?: {
3439
3467
  enter_from?: string;
3440
3468
  minis_type?: string;
@@ -3444,9 +3472,13 @@ export interface IJSBCallbackResult {
3444
3472
  is_success: number | boolean;
3445
3473
  error?: MinisError;
3446
3474
  data?: {
3475
+ /** {zh} @brief Native 埋点通参;缺失时不报对应字段。 */
3476
+ /** {en} @brief Native tracking fields; omitted fields are not reported. */
3477
+ tracking_context?: IJSBCallbackResult["tracking_context"];
3447
3478
  status: number;
3448
3479
  drama_info: {
3449
- album_id: string;
3480
+ drama_id?: string;
3481
+ album_id?: string;
3450
3482
  album_name?: string;
3451
3483
  episode_total_num?: number;
3452
3484
  drama_name?: string;
@@ -4748,19 +4780,19 @@ export interface IPlayerConfig extends IPlayerOptions {
4748
4780
  /** {zh}
4749
4781
  * @brief 起播和 playNext 的 getDramaInfo JSB 超时与重试配置。
4750
4782
  * @list Options
4751
- * @notes timeout 和 retryInterval 单位为毫秒,默认 3000 和 1000;retryCount 默认 3,表示首次请求之外的重试次数。仅重试超时、调用异常及 is_success 为 false 的结果,不重试业务审核失败。timeout 必须大于 0,retryCount 为非负整数,retryInterval 为非负数;无效值回退默认值。
4783
+ * @notes timeout 和 retryInterval 单位为毫秒,默认 10000 和 1000;retryCount 默认 3,表示首次请求之外的重试次数。仅重试超时、调用异常及 is_success 为 false 的结果,不重试业务审核失败。timeout 必须大于 0,retryCount 为非负整数,retryInterval 为非负数;无效值回退默认值。
4752
4784
  * @example
4753
4785
  * ```javascript
4754
- * new VePlayer({ dramaInfoRequest: { timeout: 3000, retryCount: 3, retryInterval: 1000 } });
4786
+ * new VePlayer({ dramaInfoRequest: { timeout: 10000, retryCount: 3, retryInterval: 1000 } });
4755
4787
  * ```
4756
4788
  */
4757
4789
  /** {en}
4758
4790
  * @brief Configure getDramaInfo JSB timeouts and retries for startup and playNext.
4759
4791
  * @list Options
4760
- * @notes timeout and retryInterval are in milliseconds, defaulting to 3000 and 1000. retryCount defaults to 3 additional attempts. Only timeouts, invocation errors and is_success=false responses are retried; business review failures are not. timeout must be positive, retryCount a nonnegative integer and retryInterval nonnegative; invalid values use defaults.
4792
+ * @notes timeout and retryInterval are in milliseconds, defaulting to 10000 and 1000. retryCount defaults to 3 additional attempts. Only timeouts, invocation errors and is_success=false responses are retried; business review failures are not. timeout must be positive, retryCount a nonnegative integer and retryInterval nonnegative; invalid values use defaults.
4761
4793
  * @example
4762
4794
  * ```javascript
4763
- * new VePlayer({ dramaInfoRequest: { timeout: 3000, retryCount: 3, retryInterval: 1000 } });
4795
+ * new VePlayer({ dramaInfoRequest: { timeout: 10000, retryCount: 3, retryInterval: 1000 } });
4764
4796
  * ```
4765
4797
  */
4766
4798
  dramaInfoRequest?: {
@@ -7155,6 +7187,48 @@ export declare const enum LangTextKey {
7155
7187
  DRAMA_FAILED_TO_QUERY = "DRAMA_FAILED_TO_QUERY",
7156
7188
  DRAMA_INVALID_TTOP_TOKEN = "DRAMA_INVALID_TTOP_TOKEN",
7157
7189
  DRAMA_NOT_ON_SHELF = "DRAMA_NOT_ON_SHELF",
7190
+ DRAMA_EMPTY_PLAYLIST = "DRAMA_EMPTY_PLAYLIST",
7191
+ DRAMA_GET_INFO_TIMEOUT = "DRAMA_GET_INFO_TIMEOUT",
7192
+ DRAMA_INVOKE_EXCEPTION = "DRAMA_INVOKE_EXCEPTION",
7193
+ DRAMA_BRIDGE_FAILURE = "DRAMA_BRIDGE_FAILURE",
7194
+ DRAMA_NATIVE_TIMEOUT = "DRAMA_NATIVE_TIMEOUT",
7195
+ DRAMA_NETWORK_FAILURE = "DRAMA_NETWORK_FAILURE",
7196
+ DRAMA_HTTP_FAILURE = "DRAMA_HTTP_FAILURE",
7197
+ DRAMA_SERVER_BUSINESS_FAILURE = "DRAMA_SERVER_BUSINESS_FAILURE",
7198
+ DRAMA_NATIVE_UNKNOWN = "DRAMA_NATIVE_UNKNOWN",
7199
+ DRAMA_EMPTY_CALLBACK = "DRAMA_EMPTY_CALLBACK",
7200
+ DRAMA_INVALID_RESPONSE = "DRAMA_INVALID_RESPONSE",
7201
+ DRAMA_INVALID_REVIEW_STATUS = "DRAMA_INVALID_REVIEW_STATUS",
7202
+ DRAMA_INVALID_VIDEO_INFO = "DRAMA_INVALID_VIDEO_INFO",
7203
+ DRAMA_MISSING_PLAYLIST = "DRAMA_MISSING_PLAYLIST",
7204
+ DRAMA_INVALID_PLAYLIST = "DRAMA_INVALID_PLAYLIST",
7205
+ DRAMA_INVALID_PLAY_ITEMS = "DRAMA_INVALID_PLAY_ITEMS",
7206
+ DRAMA_UNUSABLE_PLAY_URLS = "DRAMA_UNUSABLE_PLAY_URLS",
7207
+ DRAMA_NORMALIZED_PLAYLIST_EMPTY = "DRAMA_NORMALIZED_PLAYLIST_EMPTY",
7208
+ DRAMA_TRANSFORM_EXCEPTION = "DRAMA_TRANSFORM_EXCEPTION",
7209
+ DRAMA_ALBUM_ACCESS_DENIED = "DRAMA_ALBUM_ACCESS_DENIED",
7210
+ DRAMA_ALBUM_NOT_FOUND = "DRAMA_ALBUM_NOT_FOUND",
7211
+ DRAMA_REVIEW_RESULT_UNAVAILABLE = "DRAMA_REVIEW_RESULT_UNAVAILABLE",
7212
+ DRAMA_REVIEW_RESULT_INCONSISTENT = "DRAMA_REVIEW_RESULT_INCONSISTENT",
7213
+ DRAMA_ANCHOR_PLAYBACK_BLOCKED = "DRAMA_ANCHOR_PLAYBACK_BLOCKED",
7214
+ DRAMA_EPISODE_ENFORCED = "DRAMA_EPISODE_ENFORCED",
7215
+ DRAMA_DATABASE_ERROR = "DRAMA_DATABASE_ERROR",
7216
+ DRAMA_SERVER_INTERNAL_ERROR = "DRAMA_SERVER_INTERNAL_ERROR",
7217
+ DRAMA_REVIEW_NOT_PASSED = "DRAMA_REVIEW_NOT_PASSED",
7218
+ DRAMA_CONNECT_TIMEOUT = "DRAMA_CONNECT_TIMEOUT",
7219
+ DRAMA_READ_TIMEOUT = "DRAMA_READ_TIMEOUT",
7220
+ DRAMA_WRITE_TIMEOUT = "DRAMA_WRITE_TIMEOUT",
7221
+ DRAMA_DNS_TIMEOUT = "DRAMA_DNS_TIMEOUT",
7222
+ DRAMA_DNS_FAILURE = "DRAMA_DNS_FAILURE",
7223
+ DRAMA_INTERNET_DISCONNECTED = "DRAMA_INTERNET_DISCONNECTED",
7224
+ DRAMA_NETWORK_CHANGED = "DRAMA_NETWORK_CHANGED",
7225
+ DRAMA_CONNECTION_FAILURE = "DRAMA_CONNECTION_FAILURE",
7226
+ DRAMA_TLS_FAILURE = "DRAMA_TLS_FAILURE",
7227
+ DRAMA_TRANSPORT_EMPTY_RESPONSE = "DRAMA_TRANSPORT_EMPTY_RESPONSE",
7228
+ DRAMA_RESPONSE_INCOMPLETE = "DRAMA_RESPONSE_INCOMPLETE",
7229
+ DRAMA_TRAFFIC_CONTROL_DROP = "DRAMA_TRAFFIC_CONTROL_DROP",
7230
+ DRAMA_NATIVE_ABORTED = "DRAMA_NATIVE_ABORTED",
7231
+ DRAMA_SUCCESS_DATA_MISSING = "DRAMA_SUCCESS_DATA_MISSING",
7158
7232
  DRAMA_FAILED_GET_EPISODE_INFO = "DRAMA_FAILED_GET_EPISODE_INFO"
7159
7233
  }
7160
7234
  declare const DRAMA_ERROR_CODE: {
@@ -7204,136 +7278,222 @@ declare const DRAMA_ERROR_CODE: {
7204
7278
  readonly message: "Video is not on shelf";
7205
7279
  readonly textKey: LangTextKey.DRAMA_NOT_ON_SHELF;
7206
7280
  };
7281
+ readonly EMPTY_PLAYLIST: {
7282
+ readonly code: 9311;
7283
+ readonly message: "Episode video playlist is empty";
7284
+ readonly textKey: LangTextKey.DRAMA_EMPTY_PLAYLIST;
7285
+ };
7286
+ readonly GET_INFO_TIMEOUT: {
7287
+ readonly code: 9312;
7288
+ readonly message: "getDramaInfo request timed out";
7289
+ readonly textKey: LangTextKey.DRAMA_GET_INFO_TIMEOUT;
7290
+ };
7291
+ readonly INVOKE_EXCEPTION: {
7292
+ readonly code: 9313;
7293
+ readonly message: "getDramaInfo invocation failed";
7294
+ readonly textKey: LangTextKey.DRAMA_INVOKE_EXCEPTION;
7295
+ };
7296
+ readonly BRIDGE_FAILURE: {
7297
+ readonly code: 9314;
7298
+ readonly message: "getDramaInfo bridge failed";
7299
+ readonly textKey: LangTextKey.DRAMA_BRIDGE_FAILURE;
7300
+ };
7301
+ readonly NATIVE_TIMEOUT: {
7302
+ readonly code: 9315;
7303
+ readonly message: "Drama request timed out in Native";
7304
+ readonly textKey: LangTextKey.DRAMA_NATIVE_TIMEOUT;
7305
+ };
7306
+ readonly NETWORK_FAILURE: {
7307
+ readonly code: 9316;
7308
+ readonly message: "Drama network request failed";
7309
+ readonly textKey: LangTextKey.DRAMA_NETWORK_FAILURE;
7310
+ };
7311
+ readonly HTTP_FAILURE: {
7312
+ readonly code: 9317;
7313
+ readonly message: "Drama HTTP request failed";
7314
+ readonly textKey: LangTextKey.DRAMA_HTTP_FAILURE;
7315
+ };
7316
+ readonly SERVER_BUSINESS_FAILURE: {
7317
+ readonly code: 9318;
7318
+ readonly message: "Drama service returned a business error";
7319
+ readonly textKey: LangTextKey.DRAMA_SERVER_BUSINESS_FAILURE;
7320
+ };
7321
+ readonly NATIVE_UNKNOWN: {
7322
+ readonly code: 9319;
7323
+ readonly message: "Native drama request failed without a known cause";
7324
+ readonly textKey: LangTextKey.DRAMA_NATIVE_UNKNOWN;
7325
+ };
7326
+ readonly EMPTY_CALLBACK: {
7327
+ readonly code: 9320;
7328
+ readonly message: "getDramaInfo callback result is empty";
7329
+ readonly textKey: LangTextKey.DRAMA_EMPTY_CALLBACK;
7330
+ };
7331
+ readonly INVALID_RESPONSE: {
7332
+ readonly code: 9321;
7333
+ readonly message: "Drama response could not be parsed";
7334
+ readonly textKey: LangTextKey.DRAMA_INVALID_RESPONSE;
7335
+ };
7336
+ readonly INVALID_REVIEW_STATUS: {
7337
+ readonly code: 9322;
7338
+ readonly message: "Drama review status is invalid";
7339
+ readonly textKey: LangTextKey.DRAMA_INVALID_REVIEW_STATUS;
7340
+ };
7341
+ readonly INVALID_VIDEO_INFO: {
7342
+ readonly code: 9323;
7343
+ readonly message: "Drama video info has an invalid type";
7344
+ readonly textKey: LangTextKey.DRAMA_INVALID_VIDEO_INFO;
7345
+ };
7346
+ readonly MISSING_PLAYLIST: {
7347
+ readonly code: 9324;
7348
+ readonly message: "Drama playlist field is missing";
7349
+ readonly textKey: LangTextKey.DRAMA_MISSING_PLAYLIST;
7350
+ };
7351
+ readonly INVALID_PLAYLIST: {
7352
+ readonly code: 9325;
7353
+ readonly message: "Drama playlist has an invalid type";
7354
+ readonly textKey: LangTextKey.DRAMA_INVALID_PLAYLIST;
7355
+ };
7356
+ readonly INVALID_PLAY_ITEMS: {
7357
+ readonly code: 9326;
7358
+ readonly message: "Drama playlist contains no valid items";
7359
+ readonly textKey: LangTextKey.DRAMA_INVALID_PLAY_ITEMS;
7360
+ };
7361
+ readonly UNUSABLE_PLAY_URLS: {
7362
+ readonly code: 9327;
7363
+ readonly message: "Drama playlist contains no usable playback URL";
7364
+ readonly textKey: LangTextKey.DRAMA_UNUSABLE_PLAY_URLS;
7365
+ };
7366
+ readonly NORMALIZED_PLAYLIST_EMPTY: {
7367
+ readonly code: 9328;
7368
+ readonly message: "Normalized drama playlist is empty";
7369
+ readonly textKey: LangTextKey.DRAMA_NORMALIZED_PLAYLIST_EMPTY;
7370
+ };
7371
+ readonly TRANSFORM_EXCEPTION: {
7372
+ readonly code: 9329;
7373
+ readonly message: "Drama video info conversion failed";
7374
+ readonly textKey: LangTextKey.DRAMA_TRANSFORM_EXCEPTION;
7375
+ };
7376
+ readonly ALBUM_ACCESS_DENIED: {
7377
+ readonly code: 9330;
7378
+ readonly message: "Drama album access denied";
7379
+ readonly textKey: LangTextKey.DRAMA_ALBUM_ACCESS_DENIED;
7380
+ };
7381
+ readonly ALBUM_NOT_FOUND: {
7382
+ readonly code: 9331;
7383
+ readonly message: "Drama album not found";
7384
+ readonly textKey: LangTextKey.DRAMA_ALBUM_NOT_FOUND;
7385
+ };
7386
+ readonly REVIEW_RESULT_UNAVAILABLE: {
7387
+ readonly code: 9332;
7388
+ readonly message: "Drama review result is unavailable";
7389
+ readonly textKey: LangTextKey.DRAMA_REVIEW_RESULT_UNAVAILABLE;
7390
+ };
7391
+ readonly REVIEW_RESULT_INCONSISTENT: {
7392
+ readonly code: 9333;
7393
+ readonly message: "Drama review result is inconsistent";
7394
+ readonly textKey: LangTextKey.DRAMA_REVIEW_RESULT_INCONSISTENT;
7395
+ };
7396
+ readonly ANCHOR_PLAYBACK_BLOCKED: {
7397
+ readonly code: 9334;
7398
+ readonly message: "Drama anchor playback is blocked";
7399
+ readonly textKey: LangTextKey.DRAMA_ANCHOR_PLAYBACK_BLOCKED;
7400
+ };
7401
+ readonly EPISODE_ENFORCED: {
7402
+ readonly code: 9335;
7403
+ readonly message: "Drama episode was taken down";
7404
+ readonly textKey: LangTextKey.DRAMA_EPISODE_ENFORCED;
7405
+ };
7406
+ readonly DATABASE_ERROR: {
7407
+ readonly code: 9336;
7408
+ readonly message: "Drama service database operation failed";
7409
+ readonly textKey: LangTextKey.DRAMA_DATABASE_ERROR;
7410
+ };
7411
+ readonly SERVER_INTERNAL_ERROR: {
7412
+ readonly code: 9337;
7413
+ readonly message: "Drama service internal error";
7414
+ readonly textKey: LangTextKey.DRAMA_SERVER_INTERNAL_ERROR;
7415
+ };
7416
+ readonly REVIEW_NOT_PASSED: {
7417
+ readonly code: 9338;
7418
+ readonly message: "Drama episode has not passed review";
7419
+ readonly textKey: LangTextKey.DRAMA_REVIEW_NOT_PASSED;
7420
+ };
7421
+ readonly CONNECT_TIMEOUT: {
7422
+ readonly code: 9340;
7423
+ readonly message: "Drama connection timed out";
7424
+ readonly textKey: LangTextKey.DRAMA_CONNECT_TIMEOUT;
7425
+ };
7426
+ readonly READ_TIMEOUT: {
7427
+ readonly code: 9341;
7428
+ readonly message: "Drama response read timed out";
7429
+ readonly textKey: LangTextKey.DRAMA_READ_TIMEOUT;
7430
+ };
7431
+ readonly WRITE_TIMEOUT: {
7432
+ readonly code: 9342;
7433
+ readonly message: "Drama request write timed out";
7434
+ readonly textKey: LangTextKey.DRAMA_WRITE_TIMEOUT;
7435
+ };
7436
+ readonly DNS_TIMEOUT: {
7437
+ readonly code: 9343;
7438
+ readonly message: "Drama DNS lookup timed out";
7439
+ readonly textKey: LangTextKey.DRAMA_DNS_TIMEOUT;
7440
+ };
7441
+ readonly DNS_FAILURE: {
7442
+ readonly code: 9344;
7443
+ readonly message: "Drama DNS lookup failed";
7444
+ readonly textKey: LangTextKey.DRAMA_DNS_FAILURE;
7445
+ };
7446
+ readonly INTERNET_DISCONNECTED: {
7447
+ readonly code: 9345;
7448
+ readonly message: "Drama request failed while disconnected";
7449
+ readonly textKey: LangTextKey.DRAMA_INTERNET_DISCONNECTED;
7450
+ };
7451
+ readonly NETWORK_CHANGED: {
7452
+ readonly code: 9346;
7453
+ readonly message: "Network changed during drama request";
7454
+ readonly textKey: LangTextKey.DRAMA_NETWORK_CHANGED;
7455
+ };
7456
+ readonly CONNECTION_FAILURE: {
7457
+ readonly code: 9347;
7458
+ readonly message: "Drama network connection failed";
7459
+ readonly textKey: LangTextKey.DRAMA_CONNECTION_FAILURE;
7460
+ };
7461
+ readonly TLS_FAILURE: {
7462
+ readonly code: 9348;
7463
+ readonly message: "Drama secure connection failed";
7464
+ readonly textKey: LangTextKey.DRAMA_TLS_FAILURE;
7465
+ };
7466
+ readonly TRANSPORT_EMPTY_RESPONSE: {
7467
+ readonly code: 9349;
7468
+ readonly message: "Drama transport received no response data";
7469
+ readonly textKey: LangTextKey.DRAMA_TRANSPORT_EMPTY_RESPONSE;
7470
+ };
7471
+ readonly RESPONSE_INCOMPLETE: {
7472
+ readonly code: 9350;
7473
+ readonly message: "Drama network response is incomplete";
7474
+ readonly textKey: LangTextKey.DRAMA_RESPONSE_INCOMPLETE;
7475
+ };
7476
+ readonly TRAFFIC_CONTROL_DROP: {
7477
+ readonly code: 9351;
7478
+ readonly message: "Drama request dropped by traffic control";
7479
+ readonly textKey: LangTextKey.DRAMA_TRAFFIC_CONTROL_DROP;
7480
+ };
7481
+ readonly NATIVE_ABORTED: {
7482
+ readonly code: 9352;
7483
+ readonly message: "Drama request aborted by Native";
7484
+ readonly textKey: LangTextKey.DRAMA_NATIVE_ABORTED;
7485
+ };
7486
+ readonly SUCCESS_DATA_MISSING: {
7487
+ readonly code: 9353;
7488
+ readonly message: "Drama response declared success but has no data";
7489
+ readonly textKey: LangTextKey.DRAMA_SUCCESS_DATA_MISSING;
7490
+ };
7207
7491
  readonly FAILED_GET_EPISODE_INFO: {
7208
7492
  readonly code: 9399;
7209
7493
  readonly message: "Failed get episode info";
7210
7494
  readonly textKey: LangTextKey.DRAMA_FAILED_GET_EPISODE_INFO;
7211
7495
  };
7212
7496
  };
7213
- declare class AuthToken extends SdkPlugin {
7214
- static get pluginName(): string;
7215
- isPlayByToken: boolean;
7216
- isEncrypt: boolean;
7217
- tokenInfo: ITokenInfo;
7218
- keyTokenInfo: ITokenInfo;
7219
- thirdPartyDrmAuthTokenInfo: ITokenInfo;
7220
- config: IPlayAuthTokenConfig;
7221
- privateDrmAuthToken: string;
7222
- useUnionInfoDRM: boolean;
7223
- sessionId: string;
7224
- retryCount: number;
7225
- playInfo?: VideoInfoRes;
7226
- constructor(args: any);
7227
- beforePlayerCreate(): Promise<void>;
7228
- getVideoInfo(sourceConfigs?: IPlayerConfig): Promise<{
7229
- vid: string;
7230
- __mediaInfoCacheHit: boolean;
7231
- __dramaTrackingContext: Record<string, unknown>;
7232
- playList: Stream[];
7233
- codec: ICodecType;
7234
- defaultDefinition: string;
7235
- }>;
7236
- /**
7237
- * 短剧 Minis 环境:通过 JSB getDramaInfo 获取媒体信息
7238
- */
7239
- getDramaInfoViaJSB(sourceConfigs?: IPlayerConfig): Promise<VideoInfoRes | undefined>;
7240
- /**
7241
- * 将审核状态映射到短剧错误码
7242
- */
7243
- mapReviewStatusToErrorCode(status: number): keyof typeof DRAMA_ERROR_CODE;
7244
- /**
7245
- * 根据 JSB 返回的 msg 或 status 映射到错误码 key
7246
- */
7247
- mapDramaErrorCode(msg: string, status?: number): keyof typeof DRAMA_ERROR_CODE;
7248
- /**
7249
- * 将 JSB 返回的 video_info 转换为 VideoInfoRes 格式
7250
- */
7251
- transformDramaVideoInfoToRes(videoInfo: any, config: IPlayAuthTokenConfig): VideoInfoRes;
7252
- callOnGetMediaInfo(mediaInfo: VideoInfoRes | undefined, fromCache: boolean): void;
7253
- reportGetDramaInfoPerf(res: IJSBCallbackResult | undefined, request: {
7254
- albumId?: string;
7255
- episodeId?: string;
7256
- vid?: string;
7257
- }): void;
7258
- getVideos(sourceConfigs?: IPlayerConfig): Promise<any>;
7259
- getPrivateDrmInfo(playList: Stream[], vid: string, streamType: string): Promise<void>;
7260
- getThumbnailConfig(thumbs: IThumbInfoItem[]): void;
7261
- getBarrageMaskUrl(url: string): void;
7262
- setSubtitleConfig(mediaInfo: VideoInfoRes | undefined): void;
7263
- getAutoSubtitleList(mediaInfo: VideoInfoRes): ISubTitleItem[];
7264
- getSubtitleSourceData(mediaInfo: VideoInfoRes): any;
7265
- getAutoSubtitleItem(item: any, index: number): ISubTitleItem | undefined;
7266
- getStringAutoSubtitleItem(item: string, index: number): ISubTitleItem;
7267
- getObjectAutoSubtitleItem(item: any, index: number): ISubTitleItem | undefined;
7268
- formatAutoSubtitleItem(subtitleItem: ISubTitleItem, rawItem: any, index: number): ISubTitleItem | undefined;
7269
- getDrmConfig(videoInfo: IVideoInfo): void;
7270
- /**
7271
- * 是否处于短剧 Minis 环境(通过剧 ID + 剧集 ID 获取视频)
7272
- */
7273
- get isMinisDramaMode(): boolean;
7274
- init(): void;
7275
- initConfig(getVideoByToken: IPlayAuthTokenConfig, sourceConfigs?: IPlayerConfig): void;
7276
- /**
7277
- * 剧集切换:configs 已由 player 更新 album_id/episode_id,重新拉取媒体信息
7278
- */
7279
- updateDramaEpisode(isNewVideo: boolean, candidateConfig?: IPlayerConfig): Promise<void>;
7280
- /**
7281
- * @description 更新playAuthToken
7282
- * @param {IPlayAuthTokenConfig} getVideoByToken token信息
7283
- * @param {boolean} isNewVideo 是否新视频,即是否为切换视频
7284
- */
7285
- updateAuthToken(getVideoByToken: IPlayAuthTokenConfig, isNewVideo: boolean): Promise<void>;
7286
- checkPlayAuthTokenValid(): boolean;
7287
- checkKeyTokenValid(): boolean;
7288
- checkDrmAuthTokenValid(): boolean;
7289
- }
7290
- /** {zh}
7291
- * @hidden
7292
- */
7293
- /** {en}
7294
- * @hidden
7295
- */
7296
- export interface IAdaptRangeDefaultOptions {
7297
- maxTargetCacheDur: number;
7298
- minTargetCacheDur: number;
7299
- rangeMaxDuration: number;
7300
- rangeMinDuration: number;
7301
- cacheSafeFactor: number;
7302
- estPTcontrol: boolean;
7303
- estPlayTime: number;
7304
- minBandwidth: number;
7305
- minDangerThreshold: number;
7306
- rangeControl: boolean;
7307
- rangeMinSize: number;
7308
- safeFactor: number;
7309
- targetCacheControl: boolean;
7310
- }
7311
- declare abstract class AbstractBaseAdapter {
7312
- isLive: boolean;
7313
- playerData: PlayerData;
7314
- streamType: string;
7315
- constructor(options: {
7316
- configs: IPlayerConfig;
7317
- playerData: PlayerData;
7318
- streamType: string;
7319
- });
7320
- /**
7321
- * @description 是否使用原生video的abr能力
7322
- */
7323
- abstract useNativeAbr(): boolean;
7324
- abstract canOpenAbr(vidPlayInfo?: VideoInfoRes): boolean;
7325
- abstract applyAbrPluginConfig(_finalOptions: any, _autoBitrateOpts: any): void;
7326
- abstract prepareAbrModule(_playerData: any, _sdkUmdLoader: any): void;
7327
- abstract needAbrAutoDefinition(): boolean;
7328
- abstract setAbrDefaultDefiWithAuto(): boolean;
7329
- abstract generatePlaylistFromServer(res: VideoInfoRes, ...args: any[]): Stream[];
7330
- abstract canAdaptRangeEnable(): boolean;
7331
- abstract adaptRangeDefaultOptions(): IAdaptRangeDefaultOptions | undefined;
7332
- abstract applyAdaptRangePluginConfig(_finalOptions: any, _adaptRangeOptions: any): void;
7333
- abstract applyAdaptRangeStrategy(_finalOptions: any, _adaptRangeOptions: any): void;
7334
- abstract getPlugins(umdLoader: UMDLoader): Promise<XGPlugin[]>;
7335
- abstract setPluginConfigInVid(videoInfo: IVideoInfo, context: AuthToken): void;
7336
- }
7337
7497
  /** {zh}
7338
7498
  * @list Options
7339
7499
  * @brief 字幕项。
@@ -7566,6 +7726,162 @@ export interface ITextItem {
7566
7726
  */
7567
7727
  export type HlsAbrEngine = "hlsjs" | "veplayer";
7568
7728
  export type TLogChannel = "cn" | "va" | "sg";
7729
+ /**
7730
+ * JSB getDramaInfo 返回的客户端耗时信息,单位 ms。
7731
+ */
7732
+ export interface IGetDramaInfoPerfInfo {
7733
+ prepare_cost?: number;
7734
+ request_cost?: number;
7735
+ parse_cost?: number;
7736
+ total_cost?: number;
7737
+ [propName: string]: any;
7738
+ }
7739
+ /** {zh} @brief 仅包含可安全上报的剧集请求诊断。 @hidden */
7740
+ /** {en} @brief Safe, bounded drama request diagnostics. @hidden */
7741
+ export interface DramaDiagnostics {
7742
+ version: 1;
7743
+ code?: number;
7744
+ source?: string;
7745
+ stage?: string;
7746
+ reason?: string;
7747
+ logid?: string;
7748
+ logid_source?: string;
7749
+ perf_info?: IGetDramaInfoPerfInfo;
7750
+ attempts?: DramaDiagnostics[];
7751
+ [key: string]: any;
7752
+ }
7753
+ declare class AuthToken extends SdkPlugin {
7754
+ static get pluginName(): string;
7755
+ isPlayByToken: boolean;
7756
+ isEncrypt: boolean;
7757
+ tokenInfo: ITokenInfo;
7758
+ keyTokenInfo: ITokenInfo;
7759
+ thirdPartyDrmAuthTokenInfo: ITokenInfo;
7760
+ config: IPlayAuthTokenConfig;
7761
+ privateDrmAuthToken: string;
7762
+ useUnionInfoDRM: boolean;
7763
+ sessionId: string;
7764
+ retryCount: number;
7765
+ playInfo?: VideoInfoRes;
7766
+ private dramaRequestControllers;
7767
+ /** {zh} @brief 取消生命周期失效的剧集请求,不产生播放失败。 @hidden */
7768
+ /** {en} @brief Cancel superseded drama requests without reporting playback failure. @hidden */
7769
+ cancelDramaRequests(): void;
7770
+ destroy(): void;
7771
+ constructor(args: any);
7772
+ beforePlayerCreate(): Promise<void>;
7773
+ getVideoInfo(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<{
7774
+ vid: string;
7775
+ __mediaInfoCacheHit: boolean;
7776
+ __serverFetchDuration: number;
7777
+ __dramaTrackingContext: Record<string, unknown>;
7778
+ __dramaDiagnostics: DramaDiagnostics;
7779
+ playList: Stream[];
7780
+ codec: ICodecType;
7781
+ defaultDefinition: string;
7782
+ }>;
7783
+ private reportEmptyDramaPlaylist;
7784
+ /**
7785
+ * 短剧 Minis 环境:通过 JSB getDramaInfo 获取媒体信息
7786
+ */
7787
+ getDramaInfoViaJSB(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<VideoInfoRes | undefined>;
7788
+ /**
7789
+ * 将审核状态映射到短剧错误码
7790
+ */
7791
+ mapReviewStatusToErrorCode(status: number): keyof typeof DRAMA_ERROR_CODE;
7792
+ /**
7793
+ * 根据 JSB 返回的 msg 或 status 映射到错误码 key
7794
+ */
7795
+ mapDramaErrorCode(msg: string, status?: number): keyof typeof DRAMA_ERROR_CODE;
7796
+ /**
7797
+ * 将 JSB 返回的 video_info 转换为 VideoInfoRes 格式
7798
+ */
7799
+ transformDramaVideoInfoToRes(videoInfo: any, config: IPlayAuthTokenConfig): VideoInfoRes;
7800
+ callOnGetMediaInfo(mediaInfo: VideoInfoRes | undefined, fromCache: boolean): void;
7801
+ reportGetDramaInfoPerf(res: IJSBCallbackResult | undefined, request: {
7802
+ albumId?: string;
7803
+ episodeId?: string;
7804
+ vid?: string;
7805
+ }): void;
7806
+ getVideos(sourceConfigs?: IPlayerConfig, errors?: any[]): Promise<any>;
7807
+ getPrivateDrmInfo(playList: Stream[], vid: string, streamType: string): Promise<void>;
7808
+ getThumbnailConfig(thumbs: IThumbInfoItem[]): void;
7809
+ getBarrageMaskUrl(url: string): void;
7810
+ setSubtitleConfig(mediaInfo: VideoInfoRes | undefined): void;
7811
+ getAutoSubtitleList(mediaInfo: VideoInfoRes): ISubTitleItem[];
7812
+ getSubtitleSourceData(mediaInfo: VideoInfoRes): any;
7813
+ getAutoSubtitleItem(item: any, index: number): ISubTitleItem | undefined;
7814
+ getStringAutoSubtitleItem(item: string, index: number): ISubTitleItem;
7815
+ getObjectAutoSubtitleItem(item: any, index: number): ISubTitleItem | undefined;
7816
+ formatAutoSubtitleItem(subtitleItem: ISubTitleItem, rawItem: any, index: number): ISubTitleItem | undefined;
7817
+ getDrmConfig(videoInfo: IVideoInfo): void;
7818
+ /**
7819
+ * 是否处于短剧 Minis 环境(通过剧 ID + 剧集 ID 获取视频)
7820
+ */
7821
+ get isMinisDramaMode(): boolean;
7822
+ init(): void;
7823
+ initConfig(getVideoByToken: IPlayAuthTokenConfig, sourceConfigs?: IPlayerConfig): void;
7824
+ /**
7825
+ * 剧集切换:configs 已由 player 更新 album_id/episode_id,重新拉取媒体信息
7826
+ */
7827
+ updateDramaEpisode(isNewVideo: boolean, candidateConfig?: IPlayerConfig, errors?: any[]): Promise<void>;
7828
+ /**
7829
+ * @description 更新playAuthToken
7830
+ * @param {IPlayAuthTokenConfig} getVideoByToken token信息
7831
+ * @param {boolean} isNewVideo 是否新视频,即是否为切换视频
7832
+ */
7833
+ updateAuthToken(getVideoByToken: IPlayAuthTokenConfig, isNewVideo: boolean): Promise<void>;
7834
+ checkPlayAuthTokenValid(errors?: any[]): boolean;
7835
+ checkKeyTokenValid(errors?: any[]): boolean;
7836
+ checkDrmAuthTokenValid(errors?: any[]): boolean;
7837
+ }
7838
+ /** {zh}
7839
+ * @hidden
7840
+ */
7841
+ /** {en}
7842
+ * @hidden
7843
+ */
7844
+ export interface IAdaptRangeDefaultOptions {
7845
+ maxTargetCacheDur: number;
7846
+ minTargetCacheDur: number;
7847
+ rangeMaxDuration: number;
7848
+ rangeMinDuration: number;
7849
+ cacheSafeFactor: number;
7850
+ estPTcontrol: boolean;
7851
+ estPlayTime: number;
7852
+ minBandwidth: number;
7853
+ minDangerThreshold: number;
7854
+ rangeControl: boolean;
7855
+ rangeMinSize: number;
7856
+ safeFactor: number;
7857
+ targetCacheControl: boolean;
7858
+ }
7859
+ declare abstract class AbstractBaseAdapter {
7860
+ isLive: boolean;
7861
+ playerData: PlayerData;
7862
+ streamType: string;
7863
+ constructor(options: {
7864
+ configs: IPlayerConfig;
7865
+ playerData: PlayerData;
7866
+ streamType: string;
7867
+ });
7868
+ /**
7869
+ * @description 是否使用原生video的abr能力
7870
+ */
7871
+ abstract useNativeAbr(): boolean;
7872
+ abstract canOpenAbr(vidPlayInfo?: VideoInfoRes): boolean;
7873
+ abstract applyAbrPluginConfig(_finalOptions: any, _autoBitrateOpts: any): void;
7874
+ abstract prepareAbrModule(_playerData: any, _sdkUmdLoader: any): void;
7875
+ abstract needAbrAutoDefinition(): boolean;
7876
+ abstract setAbrDefaultDefiWithAuto(): boolean;
7877
+ abstract generatePlaylistFromServer(res: VideoInfoRes, ...args: any[]): Stream[];
7878
+ abstract canAdaptRangeEnable(): boolean;
7879
+ abstract adaptRangeDefaultOptions(): IAdaptRangeDefaultOptions | undefined;
7880
+ abstract applyAdaptRangePluginConfig(_finalOptions: any, _adaptRangeOptions: any): void;
7881
+ abstract applyAdaptRangeStrategy(_finalOptions: any, _adaptRangeOptions: any): void;
7882
+ abstract getPlugins(umdLoader: UMDLoader): Promise<XGPlugin[]>;
7883
+ abstract setPluginConfigInVid(videoInfo: IVideoInfo, context: AuthToken): void;
7884
+ }
7569
7885
  declare class PlayerData {
7570
7886
  id?: string;
7571
7887
  root?: HTMLElement;
@@ -7665,7 +7981,7 @@ declare class PlayerData {
7665
7981
  /**
7666
7982
  * @description: 获取当前的streamType
7667
7983
  */
7668
- getCurrentStreamType(): string;
7984
+ getCurrentStreamType(fallback?: string): string;
7669
7985
  getStreamType(): string;
7670
7986
  getConfiguredHlsAbrEngine(): HlsAbrEngine;
7671
7987
  isOpenVePlayerABR(): boolean;
@@ -7905,6 +8221,20 @@ export declare type IPreloadUpdateConfig = {
7905
8221
  * @detail Options
7906
8222
  */
7907
8223
  export declare type IPreloadResolvedStream = {
8224
+ /** {zh}
8225
+ * @brief HLS 分片数量,覆盖 strategies.preload.sn。
8226
+ */
8227
+ /** {en}
8228
+ * @brief HLS segment count; overrides strategies.preload.sn.
8229
+ */
8230
+ sn?: number;
8231
+ /** {zh}
8232
+ * @brief HLS master 子列表索引,覆盖 strategies.preload.level。
8233
+ */
8234
+ /** {en}
8235
+ * @brief Zero-based HLS master variant index; overrides strategies.preload.level.
8236
+ */
8237
+ level?: number;
7908
8238
  /** {zh}
7909
8239
  * @brief 视频 ID
7910
8240
  */
@@ -8030,6 +8360,9 @@ export declare type IMediaInfoPrefetchFailure = {
8030
8360
  error: {
8031
8361
  code: number;
8032
8362
  message: string;
8363
+ /** {zh} @brief 获取剧集信息失败的安全诊断。 */
8364
+ /** {en} @brief Safe diagnostics for a failed drama info request. */
8365
+ diagnostics?: DramaDiagnostics;
8033
8366
  };
8034
8367
  };
8035
8368
  /** {zh}
@@ -8091,16 +8424,30 @@ export declare type IPreloadConfig = {
8091
8424
  */
8092
8425
  preloadScene?: PreloadScene;
8093
8426
  /** {zh}
8094
- * @brief 视频格式
8427
+ * @brief 预加载格式,可传数组以同时初始化 MP4 和 HLS。
8095
8428
  * - mp4: mp4格式
8096
8429
  * - hls: hls格式
8097
8430
  * @default mp4
8098
8431
  */
8099
8432
  /** {en}
8100
- * @brief Video format.
8433
+ * @brief Preload format. An array initializes both MP4 and HLS.
8101
8434
  * @default mp4
8102
8435
  */
8103
- format?: PreloadFormat;
8436
+ format?: PreloadFormat | PreloadFormat[];
8437
+ /** {zh}
8438
+ * @brief HLS 预载分片数量,正整数,默认 2。
8439
+ */
8440
+ /** {en}
8441
+ * @brief Number of HLS segments to preload. Positive integer; defaults to 2.
8442
+ */
8443
+ sn?: number;
8444
+ /** {zh}
8445
+ * @brief HLS master 子列表索引,从 0 开始,默认 0。
8446
+ */
8447
+ /** {en}
8448
+ * @brief Zero-based HLS master variant index; defaults to 0.
8449
+ */
8450
+ level?: number;
8104
8451
  /** {zh}
8105
8452
  * 向前预加载视频个数,Feed流场景时生效
8106
8453
  * @default 1
@@ -8398,6 +8745,7 @@ declare function getMediaInfoCacheConfig(): NormalizedMediaInfoCacheConfig;
8398
8745
  export interface DramaIdentity {
8399
8746
  albumId: string | null;
8400
8747
  episodeId: string | null;
8748
+ vid: string | null;
8401
8749
  }
8402
8750
  export declare type PlayerPlaybackState = "creating" | "ready" | "playing" | "paused" | "buffering" | "ended" | "error" | "destroyed";
8403
8751
  export interface PlayerPlaybackStateSnapshot extends DramaIdentity {
@@ -8731,6 +9079,23 @@ declare class VePlayer {
8731
9079
  * ```
8732
9080
  */
8733
9081
  static prefetchMediaInfo(sources: IMediaInfoPrefetchSource[]): Promise<IMediaInfoPrefetchResult[]>;
9082
+ /** {zh}
9083
+ * @brief 全局设置是否为 MSE 媒体请求添加 x-tt-trace-id,默认关闭。
9084
+ * @param enable - 是否开启。新建播放器或下一次 playNext 时生效,当前播放保持原设置。
9085
+ * @notes 开启前需确保 CDN 的 CORS 配置允许 x-tt-trace-id。独立预加载不添加该请求头。
9086
+ * @example
9087
+ * VePlayer.setMediaTraceEnabled(true);
9088
+ * @list Api
9089
+ */
9090
+ /** {en}
9091
+ * @brief Globally enable x-tt-trace-id on MSE media requests. Disabled by default.
9092
+ * @param enable - Applies to new players and the next playNext; the current playback is unchanged.
9093
+ * @notes The CDN must allow x-tt-trace-id in CORS. Independent preloads do not include this header.
9094
+ * @example
9095
+ * VePlayer.setMediaTraceEnabled(true);
9096
+ * @list Api
9097
+ */
9098
+ static setMediaTraceEnabled(enable: boolean): void;
8734
9099
  /** {zh}
8735
9100
  * @brief 设置全局日志开关。开启后会输出 VE_DEBUG.log 级别日志。
8736
9101
  * @param enable 是否开启详细日志
@@ -9288,6 +9653,7 @@ declare class VePlayer {
9288
9653
  * @memberof VePlayer
9289
9654
  */
9290
9655
  updateAuthToken(config: IPlayAuthTokenConfig): Promise<void>;
9656
+ private _finishMediaPreparation;
9291
9657
  private _playerPlayNext;
9292
9658
  /** {zh}
9293
9659
  * @brief 返回当前视频的地址。
@@ -9367,6 +9733,7 @@ declare class VePlayer {
9367
9733
  private _buildDramaInvalidParamError;
9368
9734
  private _getDramaAlbumIdFromConfig;
9369
9735
  private _getDramaEpisodeIdFromConfig;
9736
+ private _reportPlayNextFailure;
9370
9737
  private switchDramaEpisode;
9371
9738
  /** {zh}
9372
9739
  * @brief 销毁xgplayer实例