@byteplus/veplayer 1.15.3-rc.31 → 1.15.3-rc.32

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/lite.d.ts CHANGED
@@ -1,5 +1,25 @@
1
1
  import { I18N } from 'xgplayer';
2
2
 
3
+ /** UMD modules that can be loaded or explicitly pre-registered. */
4
+ export declare enum UmdKeys {
5
+ HLS = "hls",
6
+ FLV = "flv",
7
+ XGVideo = "XGVideo",
8
+ HLSEncrypt = "hlsEncrypt",
9
+ DASH = "dash",
10
+ MP4Encrypt = "mp4Encrypt",
11
+ DanmuJS = "danmujs",
12
+ DanmuMask = "danmuMask",
13
+ StreamProbe = "streamprobe",
14
+ VeStrategy = "vestrategy",
15
+ VeStrategyH265 = "vestrategy_h265",
16
+ VeStrategyPreload = "vestrategy_preload",
17
+ VeStrategyAdaptRange = "vestrategy_adapt_range",
18
+ DashAbralgo = "DashAbralgo",
19
+ Preloader = "preloader"
20
+ }
21
+ /** Resolved UMD module values keyed by their public UMD key. */
22
+ export type UmdModules = Partial<Record<UmdKeys, unknown>>;
3
23
  export type LiteStreamType = "mp4" | "hls" | "dash" | "flv";
4
24
  export type LiteCodecType = "h264" | "h265" | "h266" | "aac" | "mp3" | "opus" | "unknown";
5
25
  export type LiteDrmType = "drm_encrypt" | "private_encrypt" | "private_encrypt_upgrade" | "standard_encrypt";
@@ -38,6 +58,145 @@ export interface LitePlayAuthTokenConfig {
38
58
  autoDemoteDefinitionTextKey?: string;
39
59
  urlQueryParams?: Record<string, string>;
40
60
  }
61
+ /** Lite-only preloading scene values supported by the player runtime. */
62
+ export type LitePreloadScene = 0 | 1;
63
+ /** Lite-safe preload strategy configuration. */
64
+ export interface LitePreloadStrategyConfig {
65
+ preloadScene?: LitePreloadScene;
66
+ prevCount?: number;
67
+ nextCount?: number;
68
+ preloadTime?: number;
69
+ preloadMaxCacheCount?: number;
70
+ Strategy?: unknown;
71
+ disabled?: boolean;
72
+ }
73
+ /** Lite strategy initialization. Full strategy names are deliberately absent. */
74
+ export interface LiteStrategyInitOptions {
75
+ /** Optional for a configured short-drama environment. */
76
+ appId?: number;
77
+ region?: "cn" | "mya" | "va" | "sg";
78
+ strategies: {
79
+ preload?: true | LitePreloadStrategyConfig;
80
+ };
81
+ deviceId?: string;
82
+ plugins?: unknown[];
83
+ Module?: unknown;
84
+ }
85
+ /** Runtime updates supported for Lite preload scenes. */
86
+ export interface LitePreloadUpdateConfig {
87
+ prevCount?: number;
88
+ nextCount?: number;
89
+ }
90
+ /** A direct media entry accepted by Lite preload APIs. */
91
+ export interface LitePreloadResolvedStream {
92
+ vid: string;
93
+ url: string;
94
+ definition: string;
95
+ streamType: "mp4";
96
+ codec: "h264";
97
+ bitrate: number;
98
+ duration: number;
99
+ size: number;
100
+ }
101
+ /** A short-drama episode accepted by Lite preload APIs. */
102
+ export interface LitePreloadDramaStream {
103
+ vid?: string;
104
+ albumId: string;
105
+ episodeId: string;
106
+ defaultDefinition?: string;
107
+ getVideoByToken?: LitePlayAuthTokenConfig;
108
+ }
109
+ /** A token-resolved VOD item accepted by Lite preload APIs. */
110
+ export interface LitePreloadAuthTokenStream {
111
+ vid?: string;
112
+ defaultDefinition?: string;
113
+ getVideoByToken: LitePlayAuthTokenConfig;
114
+ }
115
+ /** Lite preload entries do not expose Full strategy stream contracts. */
116
+ export type LitePreloadStream = LitePreloadResolvedStream | LitePreloadDramaStream | LitePreloadAuthTokenStream;
117
+ /** Request passed by the host short-drama bridge. */
118
+ export interface LiteDramaInfoRequest {
119
+ clientKey: string;
120
+ albumId: string;
121
+ episodeId: string;
122
+ vid: string;
123
+ }
124
+ /** Error returned by the host short-drama bridge. */
125
+ export interface LiteDramaInfoError {
126
+ error_code: number;
127
+ error_msg: string;
128
+ error_extra?: unknown;
129
+ }
130
+ /** Safe VOD fields exposed from a short-drama video result. */
131
+ export interface LiteDramaVideoInfo {
132
+ version?: number;
133
+ vid?: string;
134
+ status?: number;
135
+ poster_url?: string;
136
+ duration?: number;
137
+ file_type?: string;
138
+ enable_adaptive?: boolean;
139
+ total_count?: number;
140
+ adaptive_info?: unknown;
141
+ adaptive_bitrate_streaming_info?: unknown;
142
+ play_info_list?: Array<{
143
+ file_id?: string;
144
+ md5?: string;
145
+ file_type?: string;
146
+ format?: string;
147
+ codec?: string;
148
+ definition?: string;
149
+ main_play_url?: string;
150
+ backup_play_url?: string;
151
+ bitrate?: number;
152
+ width?: number;
153
+ height?: number;
154
+ size?: number;
155
+ duration?: number;
156
+ drm_type?: string;
157
+ }>;
158
+ thumb_info_list?: unknown[];
159
+ subtitle_info_list?: unknown[];
160
+ }
161
+ /** Short-drama bridge result with only Lite-safe media data. */
162
+ export interface LiteDramaInfoResponse {
163
+ is_success: number | boolean;
164
+ error?: LiteDramaInfoError;
165
+ data?: {
166
+ status: number;
167
+ drama_info: {
168
+ album_id: string;
169
+ drama_name: string;
170
+ drama_cover: string;
171
+ drama_description: string;
172
+ };
173
+ episode_info: {
174
+ episode_id: string;
175
+ episode_name: string;
176
+ episode_cover: string;
177
+ episode_description: string;
178
+ };
179
+ video_info: LiteDramaVideoInfo;
180
+ perf_info?: {
181
+ prepare_cost?: number;
182
+ request_cost?: number;
183
+ parse_cost?: number;
184
+ total_cost?: number;
185
+ };
186
+ };
187
+ }
188
+ /** Host callbacks required by Lite short-drama playback. */
189
+ export interface LiteTTDramaEnv {
190
+ channel?: "volcengine" | "byteplus";
191
+ appVersion: string;
192
+ clientKey: string;
193
+ canIUseGetDramaInfo: boolean;
194
+ canAndroidBatchGetDramaInfo?: boolean;
195
+ getDramaInfo: (callback: (res: LiteDramaInfoResponse) => void, options: LiteDramaInfoRequest) => void;
196
+ videoSecurityModule?: unknown;
197
+ sendLog: (eventName: string, params: Record<string, unknown>) => void;
198
+ getTokenVerifySecret?: () => Promise<string>;
199
+ }
41
200
  export interface LiteDefaultConfig {
42
201
  type?: "vod";
43
202
  isLive?: false;
@@ -342,6 +501,12 @@ export interface LiteVePlayerConstructor {
342
501
  readonly prototype: LiteVePlayer;
343
502
  readonly sdkVersion: string;
344
503
  new <MediaUrl extends LiteMediaUrl = LiteMediaUrl, StreamUrl extends LiteMediaUrl = LiteMediaUrl>(configs: LitePlayerConfig<MediaUrl, StreamUrl>): LiteVePlayer;
504
+ prepare(options: LiteStrategyInitOptions): Promise<void>;
505
+ registerModules(modules: UmdModules): void;
506
+ setTTDramaEnv(env: LiteTTDramaEnv): void;
507
+ setPreloadScene(preloadScene: LitePreloadScene, options?: LitePreloadUpdateConfig): void;
508
+ addPreloadList(list: LitePreloadStream[]): Promise<void>;
509
+ setPreloadList(list: LitePreloadStream[]): Promise<void>;
345
510
  getAppendVideoUrlTimestamp(): boolean;
346
511
  isMSESupported(): boolean;
347
512
  setAppendVideoUrlTimestamp(enable?: boolean): void;