@volcengine/veplayer 1.15.3-rc.10 → 1.15.3-rc.12

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
@@ -2248,6 +2248,81 @@ export interface IGetPlayInfoRes {
2248
2248
  TotalCount: number;
2249
2249
  Version: number;
2250
2250
  }
2251
+ /**
2252
+ * 短剧环境配置接口
2253
+ */
2254
+ export interface ITTDramaEnv {
2255
+ /** 云服务商,默认从构建时 env.__PLATFORM__ 获取,未注入时默认为 byteplus */
2256
+ channel?: "volcengine" | "byteplus";
2257
+ /**
2258
+ * @brief 应用版本号
2259
+ * @type {string}
2260
+ */
2261
+ appVersion: string;
2262
+ /**
2263
+ * @brief 小程序三方id
2264
+ * @type {string}
2265
+ */
2266
+ clientKey: string;
2267
+ /**
2268
+ * @brief 是否支持获取短剧信息
2269
+ * @type {boolean}
2270
+ */
2271
+ canIUseGetDramaInfo: boolean;
2272
+ /**
2273
+ * @brief 获取短剧信息
2274
+ * @type {function}
2275
+ */
2276
+ getDramaInfo: (callback: (res: IJSBCallbackResult) => void, options: IGetDramaInfoOptions) => void;
2277
+ videoSecurityModule?: any;
2278
+ /**
2279
+ * @brief 日志发送接口
2280
+ * @type {function}
2281
+ */
2282
+ sendLog: (EventName: string, params: Record<string, any>) => void;
2283
+ /**
2284
+ * 低版本 app 下验证 TTOP 签发的 playAuthToken 时使用的密钥
2285
+ * 通过 JSB(如 minis.getSecret)从 Native 获取,用于 HMAC-SHA256 签名校验
2286
+ */
2287
+ getTokenVerifySecret?: () => Promise<string>;
2288
+ }
2289
+ /**
2290
+ * JSB 获取短剧信息请求参数
2291
+ */
2292
+ export interface IGetDramaInfoOptions {
2293
+ clientKey: string;
2294
+ albumId: string;
2295
+ episodeId: string;
2296
+ vid: string;
2297
+ }
2298
+ export interface MinisError {
2299
+ error_code: number;
2300
+ error_msg: string;
2301
+ error_extra?: unknown;
2302
+ }
2303
+ /**
2304
+ * JSB 获取短剧信息返回结果
2305
+ */
2306
+ export interface IJSBCallbackResult {
2307
+ is_success: number;
2308
+ error: MinisError;
2309
+ data: {
2310
+ status: number;
2311
+ drama_info: {
2312
+ album_id: string;
2313
+ drama_name: string;
2314
+ drama_cover: string;
2315
+ drama_description: string;
2316
+ };
2317
+ episode_info: {
2318
+ episode_id: string;
2319
+ episode_name: string;
2320
+ episode_cover: string;
2321
+ episode_description: string;
2322
+ };
2323
+ video_info: IGetPlayInfoRes;
2324
+ };
2325
+ }
2251
2326
  /** {zh}
2252
2327
  * @list Options
2253
2328
  * @brief 视频编码格式。
@@ -2282,7 +2357,7 @@ export declare const CodecType: {
2282
2357
  */
2283
2358
  readonly UNKNOWN: "unknown";
2284
2359
  };
2285
- export declare type ICodecType = (typeof CodecType)[keyof typeof CodecType];
2360
+ export declare type ICodecType = typeof CodecType[keyof typeof CodecType];
2286
2361
  export declare const ContentType: {
2287
2362
  h265: string;
2288
2363
  h264: string;
@@ -2673,6 +2748,39 @@ export declare type Url = string | Array<{
2673
2748
  type?: string;
2674
2749
  [propName: string]: any;
2675
2750
  }>;
2751
+ /** {zh}
2752
+ * @list Options
2753
+ * @kind property
2754
+ * @brief 获取到媒体信息时的回调参数。
2755
+ */
2756
+ /** {en}
2757
+ * @list Options
2758
+ * @kind property
2759
+ * @brief Callback payload when media information is obtained.
2760
+ */
2761
+ export interface IGetMediaInfoCallbackPayload {
2762
+ /** {zh}
2763
+ * @brief 媒体信息。
2764
+ */
2765
+ /** {en}
2766
+ * @brief Media information.
2767
+ */
2768
+ data: {
2769
+ playList?: Stream[];
2770
+ type?: string;
2771
+ poster?: string;
2772
+ vid?: string;
2773
+ duration?: number;
2774
+ [propName: string]: any;
2775
+ };
2776
+ /** {zh}
2777
+ * @brief 媒体信息是否来自缓存。
2778
+ */
2779
+ /** {en}
2780
+ * @brief Whether the media information comes from cache.
2781
+ */
2782
+ fromCache: boolean;
2783
+ }
2676
2784
  /** {zh}
2677
2785
  * @list Options
2678
2786
  * @kind property
@@ -2718,12 +2826,29 @@ export interface IPlayerConfig extends IPlayerOptions {
2718
2826
  * @default -
2719
2827
  */
2720
2828
  vid?: string;
2829
+ /**
2830
+ * @brief 剧id,Minis 短剧播放需要
2831
+ */
2832
+ albumId?: string;
2833
+ /**
2834
+ * @brief 剧集id,Minis 短剧播放需要
2835
+ */
2836
+ episodeId?: string;
2721
2837
  /** {zh}
2722
2838
  * @brief Vid 播放配置项。应用服务端需通过 `vid` 生成临时临时播放 Token,下发给客户端。
2723
2839
  * @type {IPlayAuthTokenConfig}
2724
2840
  * @memberof IPlayerConfig
2725
2841
  */
2726
2842
  getVideoByToken?: IPlayAuthTokenConfig;
2843
+ /** {zh}
2844
+ * @brief 通过 `playAuthToken` 或缓存获取到媒体信息时触发的回调。
2845
+ * @default -
2846
+ */
2847
+ /** {en}
2848
+ * @brief Callback fired when media information is obtained from `playAuthToken` or cache.
2849
+ * @default -
2850
+ */
2851
+ onGetMediaInfo?: (payload: IGetMediaInfoCallbackPayload) => void;
2727
2852
  /** {zh}
2728
2853
  * @brief 视频加密类型
2729
2854
  * @default -
@@ -3261,6 +3386,31 @@ export interface IPlayerConfig extends IPlayerOptions {
3261
3386
  * @default -
3262
3387
  */
3263
3388
  sdkErrorPlugin?: ISdkErrorConfig;
3389
+ /** {zh}
3390
+ * @brief 原生媒体错误(如网络类 code 2/4)自动重试的最大次数,对应 {@link VeErrorOptions.oriErrRetryCount}。
3391
+ * @default 3
3392
+ */
3393
+ oriErrRetryCount?: number;
3394
+ /** {zh}
3395
+ * @brief 上述重试计数的清零周期(毫秒),超时后重试次数重新统计,对应 {@link VeErrorOptions.oriErrRetryCycle}。
3396
+ * @default 10000
3397
+ */
3398
+ oriErrRetryCycle?: number;
3399
+ /** {zh}
3400
+ * @brief 是否在原生媒体错误时自动重试拉流,对应 {@link VeErrorOptions.enableOriErrRetry}。
3401
+ * @default true
3402
+ */
3403
+ enableOriErrRetry?: boolean;
3404
+ /** {zh}
3405
+ * @brief 是否在错误时同步分析网络/流(如 XHR 探测),对应 {@link VeErrorOptions.needSyncAnalyzeError}。
3406
+ * @default true
3407
+ */
3408
+ needSyncAnalyzeError?: boolean;
3409
+ /** {zh}
3410
+ * @brief 错误分析请求超时时间(毫秒),对应 {@link VeErrorOptions.analyzeTimeout}。
3411
+ * @default 3000
3412
+ */
3413
+ analyzeTimeout?: number;
3264
3414
  /** {zh}
3265
3415
  * @brief rtm配置,配置rtm拉流参数
3266
3416
  * @notes 传入rtm流url时才生效
@@ -4233,7 +4383,7 @@ export declare type IPreloadUpdateConfig = {
4233
4383
  * 预加载视频资源
4234
4384
  * @detail Options
4235
4385
  */
4236
- export declare type IPreloadStream = {
4386
+ export declare type IPreloadResolvedStream = {
4237
4387
  /**
4238
4388
  * 视频唯一ID
4239
4389
  * @brief 视频 ID
@@ -4295,6 +4445,43 @@ export declare type IPreloadStream = {
4295
4445
  */
4296
4446
  size: number;
4297
4447
  };
4448
+ export declare type IPreloadDramaStream = {
4449
+ /**
4450
+ * 视频唯一ID
4451
+ */
4452
+ vid?: string;
4453
+ /**
4454
+ * 短剧剧 ID
4455
+ */
4456
+ albumId: string;
4457
+ /**
4458
+ * 短剧剧集 ID
4459
+ */
4460
+ episodeId: string;
4461
+ /**
4462
+ * 默认清晰度,用于缓存 key 和预加载流选择
4463
+ */
4464
+ defaultDefinition?: string;
4465
+ /**
4466
+ * Vid 播放配置。短剧预加载会复用 playAuthToken 等配置请求短剧信息。
4467
+ */
4468
+ getVideoByToken?: IPlayAuthTokenConfig;
4469
+ };
4470
+ export declare type IPreloadAuthTokenStream = {
4471
+ /**
4472
+ * 视频唯一ID
4473
+ */
4474
+ vid?: string;
4475
+ /**
4476
+ * 默认清晰度,用于选择预加载流
4477
+ */
4478
+ defaultDefinition?: string;
4479
+ /**
4480
+ * Vid 播放配置。预加载会复用 playAuthToken 请求媒体信息。
4481
+ */
4482
+ getVideoByToken: IPlayAuthTokenConfig;
4483
+ };
4484
+ export declare type IPreloadStream = IPreloadResolvedStream | IPreloadDramaStream | IPreloadAuthTokenStream;
4298
4485
  declare class VeStrategyWrapper {
4299
4486
  private tea;
4300
4487
  private static mapStrategyNameToUmdKey;
@@ -4454,6 +4641,135 @@ export declare class SdkPlugin {
4454
4641
  */
4455
4642
  __destroy(): void;
4456
4643
  }
4644
+ /**
4645
+ * @author bytedance
4646
+ * @version 1.0
4647
+ * @Description
4648
+ * @date 2024/12/16 17:59
4649
+ */
4650
+ export declare const enum LangTextKey {
4651
+ NETWORK = "NETWORK",
4652
+ NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
4653
+ NETWORK_FORBIDDEN = "NETWORK_FORBIDDEN",
4654
+ NETWORK_NOTFOUND = "NETWORK_NOTFOUND",
4655
+ NETWORK_RANGE_NOT_SATISFIABLE = "NETWORK_RANGE_NOT_SATISFIABLE",
4656
+ NETWORK_PROTOCOL = "NETWORK_PROTOCOL",
4657
+ NETWORK_URL_EXPIRE = "NETWORK_URL_EXPIRE",
4658
+ NETWORK_URL_SIGN = "NETWORK_URL_SIGN",
4659
+ NETWORK_ENCRYPT_HLS_ERR = "NETWORK_ENCRYPT_HLS_ERR",
4660
+ MEDIA_ERR = "MEDIA_ERR",
4661
+ MEDIA_ERR_ABORTED = "MEDIA_ERR_ABORTED",
4662
+ MEDIA_ERR_NETWORK = "MEDIA_ERR_NETWORK",
4663
+ MEDIA_ERR_DECODE = "MEDIA_ERR_DECODE",
4664
+ MEDIA_ERR_SRC_NOT_SUPPORTED = "MEDIA_ERR_SRC_NOT_SUPPORTED",
4665
+ MEDIA_ERR_NOT_SUPPORTED = "MEDIA_ERR_NOT_SUPPORTED",
4666
+ MEDIA_ERR_URL_EMPTY = "MEDIA_ERR_URL_EMPTY",
4667
+ MEDIA_ERR_FILE_NOT_SUPPORTED = "MEDIA_ERR_FILE_NOT_SUPPORTED",
4668
+ MEDIA_ERR_PLAY_ERR = "MEDIA_ERR_PLAY_ERR",
4669
+ MEDIA_SOURCE_CANNOT_PLAY_TYPE = "MEDIA_SOURCE_CANNOT_PLAY_TYPE",
4670
+ BUSINESS_DRM_NOT_SUPPORT = "BUSINESS_DRM_NOT_SUPPORT",
4671
+ BUSINESS_DRM_NOT_SUPPORT_UN_RECORD = "BUSINESS_DRM_NOT_SUPPORT_UN_RECORD",
4672
+ BUSINESS_DRM_LACK_MEDIA_KEY = "BUSINESS_DRM_LACK_MEDIA_KEY",
4673
+ BUSINESS_DRM_LACK_KEY_SESSION = "BUSINESS_DRM_LACK_KEY_SESSION",
4674
+ BUSINESS_DRM_GENERATE_REQUEST_FAIL = "BUSINESS_DRM_GENERATE_REQUEST_FAIL",
4675
+ BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH = "BUSINESS_DRM_LACK_SERVER_CERTIFICATE_PATH",
4676
+ BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH = "BUSINESS_DRM_LACK_SERVER_PROCESSSPC_PATH",
4677
+ BUSINESS_DRM_LICENSE_FAIL = "BUSINESS_DRM_LICENSE_FAIL",
4678
+ BUSINESS_DRM_KEY_ERROR = "BUSINESS_DRM_KEY_ERROR",
4679
+ BUSINESS_DRM_CERT_FAIL = "BUSINESS_DRM_CERT_FAIL",
4680
+ PRIVATE_DRM_KEY_GET_FAILED = "PRIVATE_DRM_KEY_GET_FAILED",
4681
+ PRIVATE_DRM_CRYPTO_NOT_SUPPORT = "PRIVATE_DRM_CRYPTO_NOT_SUPPORT",
4682
+ PRIVATE_DRM_RSA_FAIL = "PRIVATE_DRM_RSA_FAIL",
4683
+ OTHER = "OTHER",
4684
+ VOD_LOG_NOT_CONFIGURED = "VOD_LOG_NOT_CONFIGURED",
4685
+ PLAY_AUTH_TOKEN_EXPIRED = "PLAY_AUTH_TOKEN_EXPIRED",
4686
+ HLS_KEY_TOKEN_EXPIRED = "HLS_KEY_TOKEN_EXPIRED",
4687
+ THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED = "THIRD_PARTY_DRM_AUTH_TOKEN_EXPIRED",
4688
+ GET_PLAY_INFO_ERR = "GET_PLAY_INFO_ERR",
4689
+ GET_HLS_DECRYPTION_KEY_ERR = "GET_HLS_DECRYPTION_KEY_ERR",
4690
+ LICENSE_VALIDATE_FAIL = "LICENSE_VALIDATE_FAIL",
4691
+ DEFINITION_AUTO = "DEFINITION_AUTO",
4692
+ LICENSE_STATUS_INVALID = "LICENSE_STATUS_INVALID",
4693
+ LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH = "LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH",
4694
+ BASE_LICENSE_NOT_SUPPORT_265 = "BASE_LICENSE_NOT_SUPPORT_265",
4695
+ BASE_LICENSE_NOT_SUPPORT_ABR = "BASE_LICENSE_NOT_SUPPORT_ABR",
4696
+ BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER = "BASE_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",
4697
+ BASE_LICENSE_NOT_SUPPORT_PRELOAD = "BASE_LICENSE_NOT_SUPPORT_PRELOAD",
4698
+ EXPIRED_LICENSE_NOT_SUPPORT_265 = "EXPIRED_LICENSE_NOT_SUPPORT_265",
4699
+ EXPIRED_LICENSE_NOT_SUPPORT_ABR = "EXPIRED_LICENSE_NOT_SUPPORT_ABR",
4700
+ EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER = "EXPIRED_LICENSE_NOT_SUPPORT_ADAPT_BUFFER",
4701
+ EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD = "EXPIRED_LICENSE_NOT_SUPPORT_PRELOAD",
4702
+ /** Short drama (Minis) errors — codes 93xx */
4703
+ DRAMA_INVALID_PARAM = "DRAMA_INVALID_PARAM",
4704
+ DRAMA_NO_INFO_FOUND = "DRAMA_NO_INFO_FOUND",
4705
+ DRAMA_NOT_SUBMITTED = "DRAMA_NOT_SUBMITTED",
4706
+ DRAMA_UNDER_REVIEW = "DRAMA_UNDER_REVIEW",
4707
+ DRAMA_FAILED_REVIEW = "DRAMA_FAILED_REVIEW",
4708
+ DRAMA_WITHDRAWN_REVIEW = "DRAMA_WITHDRAWN_REVIEW",
4709
+ DRAMA_FAILED_TO_QUERY = "DRAMA_FAILED_TO_QUERY",
4710
+ DRAMA_INVALID_TTOP_TOKEN = "DRAMA_INVALID_TTOP_TOKEN",
4711
+ DRAMA_INVALID_PLAY_DOMAIN = "DRAMA_INVALID_PLAY_DOMAIN",
4712
+ DRAMA_NOT_ON_SHELF = "DRAMA_NOT_ON_SHELF",
4713
+ DRAMA_FAILED_GET_EPISODE_INFO = "DRAMA_FAILED_GET_EPISODE_INFO"
4714
+ }
4715
+ declare const DRAMA_ERROR_CODE: {
4716
+ /** 9301 - 短剧环境下参数不合法(如使用 url/playList 播放,或缺少 albumId / episodeId) */
4717
+ readonly INVALID_PARAM: {
4718
+ readonly code: 9301;
4719
+ readonly message: "Invalid parameter in short drama environment";
4720
+ readonly textKey: LangTextKey.DRAMA_INVALID_PARAM;
4721
+ };
4722
+ readonly NO_INFO_FOUND: {
4723
+ readonly code: 9302;
4724
+ readonly message: "No information found for this Episode";
4725
+ readonly textKey: LangTextKey.DRAMA_NO_INFO_FOUND;
4726
+ };
4727
+ readonly NOT_SUBMITTED: {
4728
+ readonly code: 9303;
4729
+ readonly message: "Episode not submitted for review";
4730
+ readonly textKey: LangTextKey.DRAMA_NOT_SUBMITTED;
4731
+ };
4732
+ readonly UNDER_REVIEW: {
4733
+ readonly code: 9304;
4734
+ readonly message: "Episode under for review";
4735
+ readonly textKey: LangTextKey.DRAMA_UNDER_REVIEW;
4736
+ };
4737
+ readonly FAILED_REVIEW: {
4738
+ readonly code: 9305;
4739
+ readonly message: "Episode failed review";
4740
+ readonly textKey: LangTextKey.DRAMA_FAILED_REVIEW;
4741
+ };
4742
+ readonly WITHDRAWN_REVIEW: {
4743
+ readonly code: 9306;
4744
+ readonly message: "Episode withdrawn from review";
4745
+ readonly textKey: LangTextKey.DRAMA_WITHDRAWN_REVIEW;
4746
+ };
4747
+ readonly FAILED_TO_QUERY: {
4748
+ readonly code: 9307;
4749
+ readonly message: "Failed to query video playback information";
4750
+ readonly textKey: LangTextKey.DRAMA_FAILED_TO_QUERY;
4751
+ };
4752
+ readonly INVALID_TTOP_TOKEN: {
4753
+ readonly code: 9308;
4754
+ readonly message: "Invalid playAuthToken or failed to verify TTOP token";
4755
+ readonly textKey: LangTextKey.DRAMA_INVALID_TTOP_TOKEN;
4756
+ };
4757
+ readonly INVALID_PLAY_DOMAIN: {
4758
+ readonly code: 9309;
4759
+ readonly message: "Invalid play domain";
4760
+ readonly textKey: LangTextKey.DRAMA_INVALID_PLAY_DOMAIN;
4761
+ };
4762
+ readonly NOT_ON_SHELF: {
4763
+ readonly code: 9310;
4764
+ readonly message: "Video is not on shelf";
4765
+ readonly textKey: LangTextKey.DRAMA_NOT_ON_SHELF;
4766
+ };
4767
+ readonly FAILED_GET_EPISODE_INFO: {
4768
+ readonly code: 9399;
4769
+ readonly message: "Failed get episode info";
4770
+ readonly textKey: LangTextKey.DRAMA_FAILED_GET_EPISODE_INFO;
4771
+ };
4772
+ };
4457
4773
  declare class AuthToken extends SdkPlugin {
4458
4774
  static get pluginName(): string;
4459
4775
  isPlayByToken: boolean;
@@ -4475,13 +4791,42 @@ declare class AuthToken extends SdkPlugin {
4475
4791
  codec: ICodecType;
4476
4792
  defaultDefinition: string;
4477
4793
  }>;
4478
- getVideos(): Promise<any>;
4794
+ /**
4795
+ * 短剧 Minis 环境:通过 JSB getDramaInfo 获取媒体信息
4796
+ */
4797
+ getDramaInfoViaJSB(): Promise<VideoInfoRes | undefined>;
4798
+ /**
4799
+ * 将审核状态映射到短剧错误码
4800
+ */
4801
+ mapReviewStatusToErrorCode(status: number): keyof typeof DRAMA_ERROR_CODE;
4802
+ /**
4803
+ * 根据 JSB 返回的 msg 或 status 映射到错误码 key
4804
+ */
4805
+ mapDramaErrorCode(msg: string, status?: number): keyof typeof DRAMA_ERROR_CODE;
4806
+ /**
4807
+ * 将 JSB 返回的 video_info 转换为 VideoInfoRes 格式
4808
+ */
4809
+ transformDramaVideoInfoToRes(videoInfo: any, config: IPlayAuthTokenConfig): VideoInfoRes;
4810
+ /**
4811
+ * 短剧环境(宿主注入 ttDramaEnv):校验每条主播放地址域名须为 *.tiktok-minis-vod.us
4812
+ */
4813
+ ensureMinisDramaPlayDomainOrReject(videoInfoRes: VideoInfoRes | undefined): VideoInfoRes | undefined;
4814
+ callOnGetMediaInfo(mediaInfo: VideoInfoRes | undefined, fromCache: boolean): void;
4815
+ getVideos(): Promise<VideoInfoRes>;
4479
4816
  getPrivateDrmInfo(playList: Stream[], vid: string, streamType: string): Promise<void>;
4480
4817
  getThumbnailConfig(thumbs: IThumbInfoItem[]): void;
4481
4818
  getBarrageMaskUrl(url: string): void;
4482
4819
  getDrmConfig(videoInfo: IVideoInfo): void;
4820
+ /**
4821
+ * 是否处于短剧 Minis 环境(通过剧 ID + 剧集 ID 获取视频)
4822
+ */
4823
+ get isMinisDramaMode(): boolean;
4483
4824
  init(): void;
4484
4825
  initConfig(getVideoByToken: IPlayAuthTokenConfig): void;
4826
+ /**
4827
+ * 剧集切换:configs 已由 player 更新 album_id/episode_id,重新拉取媒体信息
4828
+ */
4829
+ updateDramaEpisode(isNewVideo: boolean): Promise<void>;
4485
4830
  /**
4486
4831
  * @description 更新playAuthToken
4487
4832
  * @param {IPlayAuthTokenConfig} getVideoByToken token信息
@@ -4601,9 +4946,7 @@ declare class PlayerData {
4601
4946
  * @brief 私有加密会话id
4602
4947
  */
4603
4948
  encryptSessionId?: string;
4604
- constructor(configs: IPlayerConfig & {
4605
- licensSupportModuleList: string[];
4606
- }, sdk: VePlayer);
4949
+ constructor(configs: IPlayerConfig, sdk: VePlayer);
4607
4950
  /**
4608
4951
  * 初始化播放数据
4609
4952
  * @param configs { IPlayerConfig } 播放器配置
@@ -4730,34 +5073,62 @@ declare class MobilePlayerPanel {
4730
5073
  bind(event: string, eventHandle: any, isBubble?: boolean): void;
4731
5074
  destroy(): void;
4732
5075
  }
4733
- export interface IlicenseContent {
4734
- content: string;
4735
- sign: string;
4736
- mainUrl?: string;
4737
- }
4738
- declare enum LicenseEdition {
4739
- EDITION_STANDARD = "standard_edition",
4740
- EDITION_PREMIUM = "premium_edition",
4741
- EDITION_NONE = "none_edition"
4742
- }
4743
- declare enum LicenseFeature {
4744
- H265 = "h265",
4745
- PRELOAD = "preload",
4746
- ADAPT_RANGE = "adaptRange",
4747
- ABR = "abr"
4748
- }
4749
- declare enum LicenseStatus {
4750
- LICENSE_STATUS_INVALID = 0,
4751
- LICENSE_STATUS_OK = 1,
4752
- LICENSE_STATUS_EXPIRED = 2,
4753
- LICENSE_STATUS_ERROR_DOMAIN_NOT_MATCH = 401
4754
- }
4755
- export interface ILicenseConfig {
4756
- license: string | IlicenseContent;
4757
- autoUpload?: boolean;
4758
- expireDiffTime?: number;
4759
- expireCallback?: (expireDiffTime?: number) => void;
5076
+ export declare type MediaInfoCacheType = "memory" | "localStorage";
5077
+ /** {zh}
5078
+ * @brief 媒体信息本地缓存配置。
5079
+ * @list Options
5080
+ * @kind property
5081
+ */
5082
+ /** {en}
5083
+ * @brief Local media info cache config.
5084
+ * @list Options
5085
+ * @kind property
5086
+ */
5087
+ export interface MediaInfoCacheConfig {
5088
+ /** {zh}
5089
+ * @brief 是否启用媒体信息本地缓存。默认关闭。
5090
+ * @default false
5091
+ */
5092
+ /** {en}
5093
+ * @brief Whether to enable local media info cache. Disabled by default.
5094
+ * @default false
5095
+ */
5096
+ enable?: boolean;
5097
+ /** {zh}
5098
+ * @brief 缓存方式。默认使用内存缓存,设置为 localStorage 时写入浏览器本地存储。
5099
+ * @default memory
5100
+ */
5101
+ /** {en}
5102
+ * @brief Cache storage type. Memory cache is used by default. Set to localStorage to write browser local storage.
5103
+ * @default memory
5104
+ */
5105
+ cacheType?: MediaInfoCacheType;
5106
+ /** {zh}
5107
+ * @brief 缓存过期时间,单位毫秒。默认 30 分钟。
5108
+ * @default 1800000
5109
+ */
5110
+ /** {en}
5111
+ * @brief Cache expiration time in milliseconds. Defaults to 30 minutes.
5112
+ * @default 1800000
5113
+ */
5114
+ expireTime?: number;
5115
+ /** {zh}
5116
+ * @brief 最多缓存的媒体信息条数,默认 100。
5117
+ * @default 100
5118
+ */
5119
+ /** {en}
5120
+ * @brief Maximum number of media info entries to cache. Defaults to 100.
5121
+ * @default 100
5122
+ */
5123
+ maxEntries?: number;
4760
5124
  }
5125
+ export declare type NormalizedMediaInfoCacheConfig = {
5126
+ enable: boolean;
5127
+ expireTime: number;
5128
+ cacheType: MediaInfoCacheType;
5129
+ maxEntries: number;
5130
+ };
5131
+ declare function getMediaInfoCacheConfig(): NormalizedMediaInfoCacheConfig;
4761
5132
  /** {zh}
4762
5133
  * @hidden
4763
5134
  */
@@ -4773,10 +5144,6 @@ export declare type PlayerCore = Player & {
4773
5144
  panel?: MobilePlayerPanel;
4774
5145
  emitExpireTimestamp?: number;
4775
5146
  vodLogger?: VodLogger;
4776
- licenseLogInfo?: {
4777
- licenseStatus: LicenseStatus;
4778
- licenseType: LicenseEdition;
4779
- };
4780
5147
  };
4781
5148
  /**
4782
5149
  * @brief 加密混淆信息
@@ -4849,6 +5216,16 @@ declare class VePlayer {
4849
5216
  * @memberof VePlayer
4850
5217
  */
4851
5218
  private _emitter;
5219
+ /**
5220
+ * @hidden
5221
+ * createPlayer 阶段耗时采集器(仅在 createPlayer 执行期间存在)
5222
+ */
5223
+ _createPlayerPerf?: CreatePlayerPerfCollector;
5224
+ /**
5225
+ * @hidden
5226
+ * 最近一次 createPlayer 性能报告
5227
+ */
5228
+ private _lastCreatePlayerPerfReport?;
4852
5229
  /**
4853
5230
  *
4854
5231
  *
@@ -4891,6 +5268,28 @@ declare class VePlayer {
4891
5268
  * @memberof VePlayer
4892
5269
  */
4893
5270
  delayError: any[];
5271
+ /**
5272
+ * @hidden
5273
+ * When enabled, bypass `short video minis drama` play-domain validation.
5274
+ * This is only used for `ttDramaEnv` scenarios.
5275
+ */
5276
+ private static _skipMinisDramaPlayDomainValidation;
5277
+ /** {zh}
5278
+ * @brief 跳过短剧 minis 播放域名校验(仅影响 `ttDramaEnv` 下的主播放地址校验)。
5279
+ * @param skip true=跳过校验,false=恢复校验
5280
+ */
5281
+ /** {en}
5282
+ * @brief Skip minis drama play-domain validation (only affects `ttDramaEnv` scenarios).
5283
+ * @param skip true=skip validation, false=restore validation
5284
+ */
5285
+ static setSkipMinisDramaPlayDomainValidation(skip?: boolean): void;
5286
+ /** {zh}
5287
+ * @hidden
5288
+ */
5289
+ /** {en}
5290
+ * @hidden
5291
+ */
5292
+ static getSkipMinisDramaPlayDomainValidation(): boolean;
4894
5293
  /**
4895
5294
  * @hidden
4896
5295
  * umd加载器
@@ -4906,7 +5305,6 @@ declare class VePlayer {
4906
5305
  /**
4907
5306
  * @hidden
4908
5307
  */
4909
- static isRTMSupported: typeof import("@byted/xgplayer-rts").RtsPlugin.isSupported;
4910
5308
  /**
4911
5309
  * @hidden
4912
5310
  */
@@ -4917,6 +5315,51 @@ declare class VePlayer {
4917
5315
  * @memberof VePlayer
4918
5316
  */
4919
5317
  static sdkVersion: string;
5318
+ /**
5319
+ * @brief TT短剧环境配置
5320
+ * @type {ITTDramaEnv | null}
5321
+ * @memberof VePlayer
5322
+ */
5323
+ static ttDramaEnv: ITTDramaEnv | null;
5324
+ /** {zh}
5325
+ * @brief 设置TT短剧播放环境
5326
+ * @param env 短剧环境配置,详情见{@link ITTDramaEnv}
5327
+ */
5328
+ static setTTDramaEnv(env: ITTDramaEnv): void;
5329
+ /** {zh}
5330
+ * @brief 设置媒体信息本地缓存配置,默认关闭。开启后,通过短剧信息或 playAuthToken 获取媒体信息时优先使用缓存。
5331
+ * @param config 缓存配置
5332
+ */
5333
+ /** {en}
5334
+ * @brief Set the local media info cache config. It is disabled by default. When enabled, media info from drama info or playAuthToken prefers cached data.
5335
+ * @param config Cache config
5336
+ */
5337
+ static setMediaInfoCacheConfig(config: MediaInfoCacheConfig): void;
5338
+ /** {zh}
5339
+ * @brief 获取当前媒体信息本地缓存配置。
5340
+ * @returns 当前媒体信息缓存配置。
5341
+ */
5342
+ /** {en}
5343
+ * @brief Get current local media info cache config.
5344
+ * @returns Current media info cache config.
5345
+ */
5346
+ static getMediaInfoCacheConfig(): ReturnType<typeof getMediaInfoCacheConfig>;
5347
+ /** {zh}
5348
+ * @brief 清除媒体信息缓存,会同时清除内存缓存和 localStorage 缓存。
5349
+ */
5350
+ /** {en}
5351
+ * @brief Clear media info cache from both memory cache and localStorage cache.
5352
+ */
5353
+ static clearMediaInfoCache(): void;
5354
+ /** {zh}
5355
+ * @brief 设置全局日志开关。开启后会输出 VE_DEBUG.log 级别日志。
5356
+ * @param enable 是否开启详细日志
5357
+ */
5358
+ /** {en}
5359
+ * @brief Set the global log switch. When enabled, VE_DEBUG.log level logs are printed.
5360
+ * @param enable Whether to enable verbose logs
5361
+ */
5362
+ static setDebug(enable: boolean): void;
4920
5363
  /**
4921
5364
  * @hidden
4922
5365
  */
@@ -4949,29 +5392,17 @@ declare class VePlayer {
4949
5392
  * @brief 添加待预加载视频列表
4950
5393
  * @param list 待预加载视频列表,详情见{@link IPreloadStream[]}。
4951
5394
  */
4952
- static addPreloadList(list: IPreloadStream[]): void;
5395
+ static addPreloadList(list: IPreloadStream[]): Promise<void>;
4953
5396
  /** {zh}
4954
5397
  * @brief 设置待预加载视频列表,替换当前已设置的待预加载列表
4955
5398
  * @param list 待预加载视频列表,详情见{@link IPreloadStream[]}
4956
5399
  */
4957
5400
  static setPreloadList(list: IPreloadStream[]): Promise<void>;
4958
- /** {zh}
4959
- * @brief 是否支持iOS的MMS
4960
- */
4961
- static isMMSSupported: typeof isMMSSupported;
4962
5401
  /**
4963
5402
  * @hidden
4964
5403
  * @param codec
4965
5404
  * @param options
4966
5405
  */
4967
- static isRTMSupportCodec: (codec: RTMCodec, options: {
4968
- targetProfileLevel?: string;
4969
- }) => Promise<boolean>;
4970
- static setLicenseConfig(config: ILicenseConfig): Promise<void>;
4971
- static checkLicense(): Promise<LicenseEdition>;
4972
- static checkModuleList(): Promise<string[]>;
4973
- static checkLicenseStatus(): Promise<LicenseStatus>;
4974
- static checkLicenseModuleAuth(module: string, featureName: LicenseFeature): Promise<boolean>;
4975
5406
  /**
4976
5407
  * @breif 生成加密混淆的数据信息
4977
5408
  * @param unionId 用户唯一id
@@ -5119,7 +5550,6 @@ declare class VePlayer {
5119
5550
  * @hidden
5120
5551
  */
5121
5552
  createPlayer: () => Promise<PlayerCore>;
5122
- private checkLicenseCallback;
5123
5553
  /** {zh}
5124
5554
  * @hidden
5125
5555
  * @brief 设置合并开发者的插件配置,如果开发者从初始化的configs里传了插件配置,则只用开发者的配置,并补齐其他参数
@@ -5185,6 +5615,15 @@ declare class VePlayer {
5185
5615
  * @memberof VePlayer
5186
5616
  */
5187
5617
  beforePlayerCreate(): Promise<void>;
5618
+ /** {zh}
5619
+ * @hidden
5620
+ * @brief 获取最近一次 createPlayer 的性能报告。
5621
+ */
5622
+ /** {en}
5623
+ * @hidden
5624
+ * @brief Get the perf report of the latest createPlayer.
5625
+ */
5626
+ getCreatePlayerPerfReport(): ICreatePlayerPerfReport;
5188
5627
  private prepareStrategies;
5189
5628
  /**
5190
5629
  * @hidden
@@ -5231,6 +5670,7 @@ declare class VePlayer {
5231
5670
  * @memberof VePlayer
5232
5671
  */
5233
5672
  private _bindPlayerEvents;
5673
+ private _onMp4PreloadInfo;
5234
5674
  private _proxyError;
5235
5675
  private _onError;
5236
5676
  /** {zh}
@@ -5348,8 +5788,35 @@ declare class VePlayer {
5348
5788
  * @param config 播放器实例化配置。此接口仅支持 `IPlayerConfig` 中的 `url`、`playList`、`poster`、`getVideoByToken` 字段。。
5349
5789
  * @param isNewVideo 是否为新视频。为 `false` 时,更换后,会从更换前的时间点继续播放。
5350
5790
  */
5791
+ /** {zh}
5792
+ * @brief 当前播放器命中预加载的情况
5793
+ * @type {{
5794
+ * hit: number, // 0-未命中 1-命中
5795
+ * duration: 0, // 预加载时长
5796
+ * length: 0 // 预加载数据长度
5797
+ * }}
5798
+ */
5799
+ /** {en}
5800
+ * @brief Whether the current playback hit preloaded data.
5801
+ * @type {{
5802
+ * hit: number, // 0-miss 1-hit
5803
+ * duration: number, // preloaded duration
5804
+ * length: number // preloaded data length in bytes
5805
+ * }}
5806
+ */
5807
+ get preLoadData(): {
5808
+ hit: number;
5809
+ duration?: number;
5810
+ length?: number;
5811
+ };
5351
5812
  playNext(config: IPlayerConfig, isNewVideo?: boolean): Promise<any>;
5352
5813
  private _playNext;
5814
+ /** 从 playerData.configs 取出短剧 id,供 XGPlayer setConfig / playNext 与切换后 configs 一致 */
5815
+ private _getDramaConfigPatchForPlayer;
5816
+ private _buildDramaInvalidParamError;
5817
+ private _getDramaAlbumIdFromConfig;
5818
+ private _getDramaEpisodeIdFromConfig;
5819
+ private switchDramaEpisode;
5353
5820
  /** {zh}
5354
5821
  * @brief 销毁xgplayer实例
5355
5822
  *
@@ -5968,91 +6435,6 @@ export declare class MirrorPlugin extends Plugin {
5968
6435
  destroy(): void;
5969
6436
  render(): string;
5970
6437
  }
5971
- export declare type InfoItem = {
5972
- key: string;
5973
- label: string;
5974
- labelTextKey?: string;
5975
- value?: any;
5976
- render?: (key: any) => string;
5977
- type?: string;
5978
- dom?: Element;
5979
- };
5980
- /**
5981
- * 直播信息面板
5982
- */
5983
- export declare class LiveInfoPanel extends Plugin {
5984
- private _pollTimer;
5985
- private _infoItems;
5986
- static get pluginName(): string;
5987
- static get defaultConfig(): {
5988
- visible: boolean;
5989
- showH265Info: boolean;
5990
- };
5991
- get streamType(): any;
5992
- afterCreate(): void;
5993
- registerLanguageTexts(): {
5994
- DECODEFPS: {
5995
- en: string;
5996
- zh: string;
5997
- };
5998
- DECODECOST: {
5999
- en: string;
6000
- zh: string;
6001
- };
6002
- FORMAT: {
6003
- en: string;
6004
- zh: string;
6005
- };
6006
- FPS: {
6007
- en: string;
6008
- zh: string;
6009
- };
6010
- BITRATE: {
6011
- en: string;
6012
- zh: string;
6013
- };
6014
- GOP: {
6015
- en: string;
6016
- zh: string;
6017
- };
6018
- RESOLUTION: {
6019
- en: string;
6020
- zh: string;
6021
- };
6022
- ENCODETYPE: {
6023
- en: string;
6024
- zh: string;
6025
- };
6026
- BUFFEREND: {
6027
- en: string;
6028
- zh: string;
6029
- };
6030
- CURRENTTIME: {
6031
- en: string;
6032
- zh: string;
6033
- };
6034
- };
6035
- _getDefaultInfo(data: any): Record<string, InfoItem>;
6036
- _init(): void;
6037
- _getStats(): any;
6038
- _getInfoListData(): Record<string, InfoItem>;
6039
- _initDom(infoItems: any): any;
6040
- _updateTitle(rowDom: Element, item: InfoItem): void;
6041
- _updateDom(rowdom: Element, newItem: InfoItem): void;
6042
- _renderLabel(item: InfoItem): any;
6043
- _renderValue(item: InfoItem): any;
6044
- _handleDataChange(): void;
6045
- _tick(): void;
6046
- _poll(): void;
6047
- destroy(): void;
6048
- _handleError(): void;
6049
- _handleLoadedData(): void;
6050
- _open(): void;
6051
- _close(): void;
6052
- open(): void;
6053
- close(): void;
6054
- render(): string;
6055
- }
6056
6438
  export declare const Events: {
6057
6439
  /** {zh}
6058
6440
  * @brief 弹幕配置发生变化。
@@ -6194,6 +6576,13 @@ export declare const Events: {
6194
6576
  * @brief 多码率自适应播放时,自动挡位对应的清晰度改变。
6195
6577
  */
6196
6578
  ABR_AUTO_DESC_CHANGE: string;
6579
+ /** {zh}
6580
+ * @brief mp4 加密插件命中预加载数据时触发。data 为预加载缓存对象,含 `byteLength`、`duration`、`mediaSegList` 等字段。
6581
+ */
6582
+ /** {en}
6583
+ * @brief Fired when the mp4 encrypt plugin finds a preload cache hit. The event data is the preload cache object, including fields such as `byteLength`, `duration`, and `mediaSegList`.
6584
+ */
6585
+ PRELOAD_INFO: string;
6197
6586
  /** {zh}
6198
6587
  * @brief 播放器实例创建完成时触发。
6199
6588
  */
@@ -6344,10 +6733,21 @@ export declare const Events: {
6344
6733
  * @brief Autoplay fails to start.
6345
6734
  */
6346
6735
  AUTOPLAY_PREVENTED: string;
6736
+ /** {zh}
6737
+ * @brief 播放器准备创建。
6738
+ */
6739
+ READY_CREATE_PLAYER: string;
6347
6740
  /** {zh}
6348
6741
  * @brief 播放器完成创建。
6349
6742
  */
6350
6743
  PLAYER_CREATED_FINISH: string;
6744
+ /** {zh}
6745
+ * @brief createPlayer 性能报告。与 `PLAYER_CREATED_FINISH` 几乎同时触发(略早)。
6746
+ */
6747
+ /** {en}
6748
+ * @brief createPlayer performance report. Fired almost at the same time as `PLAYER_CREATED_FINISH` (slightly earlier).
6749
+ */
6750
+ CREATE_PLAYER_PERF: string;
6351
6751
  /** {zh}
6352
6752
  * @brief 播放器重建。
6353
6753
  */
@@ -6667,10 +7067,21 @@ export declare const Event: {
6667
7067
  * @brief Autoplay fails to start.
6668
7068
  */
6669
7069
  AUTOPLAY_PREVENTED: string;
7070
+ /** {zh}
7071
+ * @brief 播放器准备创建。
7072
+ */
7073
+ READY_CREATE_PLAYER: string;
6670
7074
  /** {zh}
6671
7075
  * @brief 播放器完成创建。
6672
7076
  */
6673
7077
  PLAYER_CREATED_FINISH: string;
7078
+ /** {zh}
7079
+ * @brief createPlayer 性能报告。与 `PLAYER_CREATED_FINISH` 几乎同时触发(略早)。
7080
+ */
7081
+ /** {en}
7082
+ * @brief createPlayer performance report. Fired almost at the same time as `PLAYER_CREATED_FINISH` (slightly earlier).
7083
+ */
7084
+ CREATE_PLAYER_PERF: string;
6674
7085
  /** {zh}
6675
7086
  * @brief 播放器重建。
6676
7087
  */
@@ -6865,12 +7276,18 @@ export declare const Event: {
6865
7276
  * @brief 多码率自适应播放时,自动挡位对应的清晰度改变。
6866
7277
  */
6867
7278
  ABR_AUTO_DESC_CHANGE: string;
7279
+ /** {zh}
7280
+ * @brief mp4 加密插件命中预加载数据时触发。data 为预加载缓存对象,含 `byteLength`、`duration`、`mediaSegList` 等字段。
7281
+ */
7282
+ /** {en}
7283
+ * @brief Fired when the mp4 encrypt plugin finds a preload cache hit. The event data is the preload cache object, including fields such as `byteLength`, `duration`, and `mediaSegList`.
7284
+ */
7285
+ PRELOAD_INFO: string;
6868
7286
  };
6869
7287
  };
6870
7288
  export * from "xgplayer";
6871
7289
 
6872
7290
  export {
6873
- LiveSubTitlesPlugin as LiveSubtitlesPlugin,
6874
7291
  MusicPreset as Music,
6875
7292
  VePlayer as default,
6876
7293
  };