@volcengine/veplayer 1.12.0 → 1.13.0-rc.0

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
@@ -6,6 +6,8 @@ import VodLogger from '@byted/xgplayer-app-logger/es/logger';
6
6
  import EventEmitter from 'eventemitter3';
7
7
  import Player from 'xgplayer';
8
8
  import { BasePlugin, I18N, IXGI18nText, Plugin } from 'xgplayer';
9
+ import XGAdsPlugin from 'xgplayer-ads';
10
+ import { AdsPluginConfig } from 'xgplayer-ads/es/plugin';
9
11
  import { IUrl } from 'xgplayer/es/defaultConfig';
10
12
 
11
13
  /**
@@ -258,14 +260,14 @@ export interface IDanmuConfig {
258
260
  */
259
261
  fontSize?: number;
260
262
  /**
261
- * @brief 是否打开面板。取值如下:
263
+ * @brief 是否默认开启弹幕。取值如下:
262
264
  *
263
- * - `false`:关闭面板。
264
- * - `true`:打开面板。
265
+ * - `false`:关闭。
266
+ * - `true`:开启。
265
267
  * @default false
266
268
  */
267
269
  /** {en}
268
- * @brief 是否打开面板
270
+ * @brief 是否默认开启弹幕
269
271
  */
270
272
  active?: boolean;
271
273
  /**
@@ -277,7 +279,7 @@ export interface IDanmuConfig {
277
279
  * @hidden
278
280
  */
279
281
  /** {en}
280
- * @brief 是否展示弹幕设置面板
282
+ * @brief Whether to enable barrage by default
281
283
  */
282
284
  usePanel?: boolean;
283
285
  /**
@@ -295,11 +297,13 @@ export interface IDanmuConfig {
295
297
  */
296
298
  external?: ExternalItem[];
297
299
  /**
298
- * @hidden
300
+ * @brief 蒙版弹幕配置
301
+ * @default -
299
302
  */
300
303
  maskConfig?: IMaskConfig;
301
304
  /**
302
- * @hidden
305
+ * @brief 是否开启蒙版弹幕,即对应智能挡板开关
306
+ * @default false
303
307
  */
304
308
  maskActive?: boolean;
305
309
  }
@@ -1574,6 +1578,11 @@ export interface IStartConfig {
1574
1578
  */
1575
1579
  mode?: "hide" | "show" | "auto";
1576
1580
  }
1581
+ /**
1582
+ * @hidden
1583
+ * @brief 西瓜插件
1584
+ */
1585
+ export declare type XGPlugin = typeof Plugin | typeof BasePlugin;
1577
1586
  /**
1578
1587
  * @brief 自动播放配置。
1579
1588
  * @list Options
@@ -2118,14 +2127,9 @@ export declare class MemoryPlay extends Plugin {
2118
2127
  getTimeByStorage(memoryId: string): string | 0;
2119
2128
  destroy(): void;
2120
2129
  }
2121
- /** {zh}
2122
- * @hidden
2123
- */
2124
- export declare const enum EDRMTYPE {
2125
- DRM_ENCRYPT = "drm_encrypt",
2126
- PRIVATE_ENCRYPT = "private_encrypt",
2127
- PRIVATE_ENCRYPT_UPGRADE = "private_encrypt_upgrade",
2128
- STANDARD_ENCRYPT = "standard_encrypt"
2130
+ export interface IVolume {
2131
+ Loudness: number;
2132
+ Peak: number;
2129
2133
  }
2130
2134
  /** {zh}
2131
2135
  * @hidden
@@ -2136,7 +2140,7 @@ export interface IPlayInfoListItem {
2136
2140
  BarrageMaskOffset: string;
2137
2141
  Bitrate: number;
2138
2142
  CheckInfo: string;
2139
- Codec: CodecType;
2143
+ Codec: ICodecType;
2140
2144
  Definition: string;
2141
2145
  Duration: number;
2142
2146
  FileId: string;
@@ -2241,55 +2245,62 @@ export interface IGetPlayInfoRes {
2241
2245
  TotalCount: number;
2242
2246
  Version: number;
2243
2247
  }
2244
- /**
2245
- * @author bytedance
2246
- * @version 1.0
2247
- * @Description
2248
- * @date 2024/5/17 15:53
2249
- */
2250
2248
  /** {zh}
2251
2249
  * @list Options
2252
2250
  * @brief 视频编码格式。
2253
2251
  */
2254
- export declare const enum CodecType {
2252
+ export declare const CodecType: {
2255
2253
  /** {zh}
2256
2254
  * @brief H.264
2257
2255
  */
2258
- H264 = "h264",
2256
+ readonly H264: "h264";
2259
2257
  /** {zh}
2260
2258
  * @brief H.265
2261
2259
  */
2262
- H265 = "h265",
2260
+ readonly H265: "h265";
2263
2261
  /** {zh}
2264
2262
  * @brief H.266
2265
2263
  */
2266
- H266 = "h266",
2264
+ readonly H266: "h266";
2267
2265
  /** {zh}
2268
2266
  * @brief 音频 AAC,含 heaacv2
2269
2267
  */
2270
- AAC = "aac",
2268
+ readonly AAC: "aac";
2271
2269
  /** {zh}
2272
2270
  * @brief 音频 MP3
2273
2271
  */
2274
- MP3 = "mp3",
2272
+ readonly MP3: "mp3";
2275
2273
  /** {zh}
2276
2274
  * @brief 音频 OPUS
2277
2275
  */
2278
- OPUS = "opus",
2276
+ readonly OPUS: "opus";
2279
2277
  /** {zh}
2280
2278
  * @brief 未知编码格式
2281
2279
  */
2282
- UNKNOWN = "unknown"
2283
- }
2284
- declare enum RTMCodec {
2280
+ readonly UNKNOWN: "unknown";
2281
+ };
2282
+ export declare type ICodecType = (typeof CodecType)[keyof typeof CodecType];
2283
+ export declare const ContentType: {
2284
+ h265: string;
2285
+ h264: string;
2286
+ };
2287
+ export declare enum RTMCodec {
2285
2288
  H264 = "h264"
2286
2289
  }
2287
- declare enum EVideoFormat {
2290
+ /** {zh}
2291
+ * @hidden
2292
+ * @brief 音频封装格式
2293
+ */
2294
+ export declare enum EVideoFormat {
2288
2295
  MP4 = "mp4",
2289
2296
  DASH = "dash",
2290
2297
  HLS = "hls"
2291
2298
  }
2292
- declare enum EAudioFormat {
2299
+ /** {zh}
2300
+ * @hidden
2301
+ * @brief 视频封装格式
2302
+ */
2303
+ export declare enum EAudioFormat {
2293
2304
  M4A = "m4a",
2294
2305
  MP4 = "mp4",
2295
2306
  MP3 = "mp3",
@@ -2297,6 +2308,45 @@ declare enum EAudioFormat {
2297
2308
  HLS = "hls",
2298
2309
  OGG = "ogg"
2299
2310
  }
2311
+ /** {zh}
2312
+ * @brief 加密播放类型
2313
+ */
2314
+ export declare const enum EDRMTYPE {
2315
+ /**
2316
+ * @brief 商业DRM
2317
+ */
2318
+ DRM_ENCRYPT = "drm_encrypt",
2319
+ /**
2320
+ * @brief 旧私有加密
2321
+ */
2322
+ PRIVATE_ENCRYPT = "private_encrypt",
2323
+ /**
2324
+ * @brief 新私有加密
2325
+ */
2326
+ PRIVATE_ENCRYPT_UPGRADE = "private_encrypt_upgrade",
2327
+ /**
2328
+ * @brief HLS标准加密
2329
+ */
2330
+ STANDARD_ENCRYPT = "standard_encrypt"
2331
+ }
2332
+ export interface IVideoInfo {
2333
+ playList: Stream[];
2334
+ vid: string;
2335
+ defaultDefinitionData: Stream;
2336
+ codec: ICodecType;
2337
+ dashOpts?: {
2338
+ Data: IGetPlayInfoRes;
2339
+ };
2340
+ }
2341
+ export declare type TRegionConfig = {
2342
+ __PLAY_DOMAIN__: string;
2343
+ __BACKUP_PLAY_DOMAIN__?: string;
2344
+ __LOG_TEA_ID__: number;
2345
+ __LOG_CHANNEL__: TLogChannel;
2346
+ __LOG_CUSTOM_REGION__?: string;
2347
+ __UMD_PRE_PATH__: string;
2348
+ };
2349
+ export declare type TLogChannel = "cn" | "va" | "sg";
2300
2350
  /** {zh}
2301
2351
  * @brief 区域类型:
2302
2352
  * - `'cn'`:中国内地
@@ -2492,7 +2542,7 @@ export interface Stream extends Partial<IPlayInfoListItem> {
2492
2542
  * @brief 编码格式
2493
2543
  * @default unknown
2494
2544
  */
2495
- codec?: CodecType;
2545
+ codec?: ICodecType;
2496
2546
  /** {zh}
2497
2547
  * @brief 线路唯一 ID
2498
2548
  */
@@ -2538,6 +2588,20 @@ export interface Stream extends Partial<IPlayInfoListItem> {
2538
2588
  * @default -
2539
2589
  */
2540
2590
  urlExpireTimestamp?: number;
2591
+ /**
2592
+ * @brief 视频为加密视频时的密钥KeyId,对应{@link https://www.volcengine.com/docs/4/2918 GetPlayInfo} 接口返回的PlayInfoList项中的 PlayAuthId
2593
+ * @default -
2594
+ */
2595
+ kid?: string;
2596
+ /** {zh}
2597
+ * @brief 私有加密播放的加密密钥,对应{@link https://www.volcengine.com/docs/4/2918 GetPlayInfo} 接口返回的PlayInfoList项中的 PlayAuth
2598
+ */
2599
+ secretKey?: string;
2600
+ /**
2601
+ * @brief 视频为加密视频时的加密类型
2602
+ * @default -
2603
+ */
2604
+ drmType?: EDRMTYPE;
2541
2605
  /** {zh}
2542
2606
  * @hidden
2543
2607
  */
@@ -2581,21 +2645,6 @@ export interface Current extends Partial<Stream> {
2581
2645
  * @default -
2582
2646
  */
2583
2647
  lineId?: number | string;
2584
- /**
2585
- * @brief 视频编码格式
2586
- * @default unknown
2587
- */
2588
- codec?: CodecType;
2589
- /**
2590
- * @brief 视频为加密视频时的密钥KeyId
2591
- * @default -
2592
- */
2593
- kid?: string;
2594
- /**
2595
- * @brief 视频为加密视频时的加密类型
2596
- * @default -
2597
- */
2598
- drmType?: EDRMTYPE;
2599
2648
  /**
2600
2649
  * @brief 地址的过期时间戳,vid模式下不用输入,播放器自动获取。如果是火山引擎的CDN分发地址,在不传入过期时间戳时,则需指定urlType,支持{@link https://www.volcengine.com/docs/4/177191 A-E类型},其他云厂商或者业务服务器存储的地址不支持。
2601
2650
  * @default -
@@ -2670,6 +2719,24 @@ export interface IPlayerConfig extends IPlayerOptions {
2670
2719
  * @memberof IPlayerConfig
2671
2720
  */
2672
2721
  getVideoByToken?: IPlayAuthTokenConfig;
2722
+ /** {zh}
2723
+ * @brief 视频加密类型
2724
+ * @default -
2725
+ */
2726
+ drmType?: EDRMTYPE;
2727
+ /** {zh}
2728
+ * @brief 私有加密会话id
2729
+ */
2730
+ encryptSessionId?: string;
2731
+ /**
2732
+ * @brief 视频为加密视频时的密钥KeyId,对应{@link https://www.volcengine.com/docs/4/2918 GetPlayInfo} 接口返回的PlayInfoList项中的 PlayAuthId
2733
+ * @default -
2734
+ */
2735
+ playAuthId?: string;
2736
+ /** {zh}
2737
+ * @brief 私有加密播放的加密密钥,对应{@link https://www.volcengine.com/docs/4/2918 GetPlayInfo} 接口返回的PlayInfoList项中的 PlayAuth
2738
+ */
2739
+ playAuth?: string;
2673
2740
  /** {zh}
2674
2741
  * @brief 视频格式。取值如下:
2675
2742
  * - `mp4`
@@ -2809,7 +2876,7 @@ export interface IPlayerConfig extends IPlayerOptions {
2809
2876
  * @listtip - 在已知视频编码方式的情况下推荐传入,以便日志分析。
2810
2877
  * - 在 `useSoftDecoding` 参数为 `true`(开启 H.265 兼容降级模式)时,建议传入,可提升软解初始效率。
2811
2878
  */
2812
- codec?: `${CodecType}`;
2879
+ codec?: ICodecType;
2813
2880
  /** {zh}
2814
2881
  * @brief 点播服务所在区域,影响服务接口和日志上报
2815
2882
  * @default cn
@@ -3528,6 +3595,27 @@ export interface definitionItem {
3528
3595
  */
3529
3596
  definitionTextKey?: string;
3530
3597
  }
3598
+ /** {zh}
3599
+ * @brief 可扩展插件结构
3600
+ */
3601
+ export interface EventPlugin {
3602
+ pluginName: string;
3603
+ type?: "inner" | "normal" | string;
3604
+ position?: string;
3605
+ icon?: string;
3606
+ index?: number;
3607
+ tips?: Transition;
3608
+ hideAtFullScreen?: boolean;
3609
+ }
3610
+ /** {zh}
3611
+ * @brief 多语言翻译结构体
3612
+ */
3613
+ export interface Transition {
3614
+ jp?: string;
3615
+ en?: string;
3616
+ zh?: string;
3617
+ "zh-hk"?: string;
3618
+ }
3531
3619
  /** {zh}
3532
3620
  * @brief 插件按钮位置
3533
3621
  */
@@ -3574,7 +3662,7 @@ export declare const enum POSITIONS {
3574
3662
  * @brief Plugin类插件基础配置
3575
3663
  */
3576
3664
  export interface IPluginConfig {
3577
- position?: typeof Plugin.POSITIONS[keyof typeof Plugin.POSITIONS];
3665
+ position?: (typeof Plugin.POSITIONS)[keyof typeof Plugin.POSITIONS];
3578
3666
  index?: number;
3579
3667
  disable?: boolean;
3580
3668
  }
@@ -3803,6 +3891,11 @@ export interface IThumbnailConfig {
3803
3891
  */
3804
3892
  hidePortrait?: false;
3805
3893
  }
3894
+ export interface ISourceConfig {
3895
+ url?: string;
3896
+ playList?: Stream[];
3897
+ getVideByToken?: IPlayAuthTokenConfig;
3898
+ }
3806
3899
  /**
3807
3900
  * @brief api map
3808
3901
  * @hidden
@@ -4151,6 +4244,166 @@ declare class VeStrategyWrapper {
4151
4244
  private initPreloaderConfig;
4152
4245
  }
4153
4246
  declare const _default: VeStrategyWrapper;
4247
+ declare enum UmdKeys {
4248
+ HLS = "hls",
4249
+ FLV = "flv",
4250
+ XGVideo = "XGVideo",
4251
+ HLSEncrypt = "hlsEncrypt",
4252
+ DASH = "dash",
4253
+ MP4Encrypt = "mp4Encrypt",
4254
+ DanmuJS = "danmujs",
4255
+ DanmuMask = "danmuMask",
4256
+ StreamProbe = "streamprobe",
4257
+ VeStrategy = "vestrategy",
4258
+ VeStrategyH265 = "vestrategy_h265",
4259
+ VeStrategyPreload = "vestrategy_preload",
4260
+ VeStrategyAdaptRange = "vestrategy_adapt_range",
4261
+ DashAbralgo = "DashAbralgo",
4262
+ Preloader = "preloader"
4263
+ }
4264
+ /**
4265
+ * @hidden
4266
+ * @breif umdmap 配置
4267
+ */
4268
+ export declare type UMDMap = Record<UmdKeys, {
4269
+ /**
4270
+ * umd Module 的名称,即在window下暴露的接口名称
4271
+ */
4272
+ name: string;
4273
+ /**
4274
+ * 对应umd文件名,只用来标记,实际不使用
4275
+ */
4276
+ pluginName?: string;
4277
+ /**
4278
+ * 对应npm包的名称,在打包文件时,会在libd.config.js中onPostBuild的钩子中会用于寻找对应npm包
4279
+ */
4280
+ packageName: string;
4281
+ /**
4282
+ * npm包中umd入口文件路径,用于打包上传到cdn目录
4283
+ */
4284
+ devPath: string;
4285
+ }>;
4286
+ declare class UMDLoader {
4287
+ private static jsLoadMap;
4288
+ private static jsLoadPromiseMap;
4289
+ umdMap: UMDMap;
4290
+ backupUmdUrlMap: Record<string, string>;
4291
+ failCallback: (umdName: string, err: any) => any;
4292
+ region: TRegionType;
4293
+ customPluginPublicPath: string;
4294
+ importedPlugins: any[];
4295
+ constructor();
4296
+ /**
4297
+ * @return { string } 插件加载的公共路径
4298
+ */
4299
+ get pluginPublicPath(): string;
4300
+ /**
4301
+ * 更新umd的备用地址
4302
+ * @param {Record<string, string>} map 备用地址map
4303
+ */
4304
+ updateBackupMap(map: Record<string, string>): void;
4305
+ /**
4306
+ * 加载额外的js-sdk
4307
+ * 适用 umd 模块
4308
+ * 只能浏览器环境下使用
4309
+ * @param url 额外加载JS 的 CDN 地址
4310
+ * @param isJs 是否js文件
4311
+ */
4312
+ loadExtraCdn(url: string, isJs?: boolean): Promise<void>;
4313
+ /**
4314
+ * @description 加载xgplayer插件
4315
+ * @param pluginName 插件名称
4316
+ * @param successCallback 加载完成后执行的回调
4317
+ * @return Promise<any>
4318
+ */
4319
+ loadPlugins(pluginName: UmdKeys, successCallback?: () => void): Promise<any>;
4320
+ }
4321
+ export declare class SdkPlugin {
4322
+ pluginName: string;
4323
+ __args: any;
4324
+ sdk: VePlayer;
4325
+ playerData: PlayerData;
4326
+ player: Player;
4327
+ _emitter: EventEmitter;
4328
+ static defineGetterOrSetter(Obj: any, map: any): void;
4329
+ /**
4330
+ * @type { string }
4331
+ */
4332
+ static get pluginName(): string;
4333
+ /**
4334
+ * @constructor
4335
+ * @param { { sdk: object, pluginName: string, [propName: string]: any;} } args
4336
+ */
4337
+ constructor(args: any);
4338
+ /**
4339
+ * @description sdk实例创建,挂载插件实例时首先执行
4340
+ */
4341
+ beforeCreate(): void;
4342
+ /**
4343
+ * @description sdk实例创建,挂载插件实例完后执行
4344
+ */
4345
+ afterCreate(): void;
4346
+ /**
4347
+ * @description sdk创建播放器前执行,只有这里能保证异步操作在creatPlayer之前同步完成
4348
+ */
4349
+ beforePlayerCreate(): void;
4350
+ /**
4351
+ * @description sdk创建播放器完执行
4352
+ */
4353
+ afterPlayerCreate(): void;
4354
+ /**
4355
+ * @description sdk销毁时执行
4356
+ */
4357
+ destroy(): void;
4358
+ /**
4359
+ * @private
4360
+ * @param { any } args
4361
+ */
4362
+ __init(args: any): void;
4363
+ /**
4364
+ * @description 插件销毁
4365
+ * @private
4366
+ */
4367
+ __destroy(): void;
4368
+ }
4369
+ declare class AuthToken extends SdkPlugin {
4370
+ static get pluginName(): string;
4371
+ isPlayByToken: boolean;
4372
+ isEncrypt: boolean;
4373
+ tokenInfo: ITokenInfo;
4374
+ keyTokenInfo: ITokenInfo;
4375
+ thirdPartyDrmAuthTokenInfo: ITokenInfo;
4376
+ config: IPlayAuthTokenConfig;
4377
+ privateDrmAuthToken: string;
4378
+ useUnionInfoDRM: boolean;
4379
+ sessionId: string;
4380
+ retryCount: number;
4381
+ playInfo?: VideoInfoRes;
4382
+ constructor(args: any);
4383
+ beforePlayerCreate(): Promise<void>;
4384
+ getVideoInfo(): Promise<{
4385
+ vid: string;
4386
+ playList: Stream[];
4387
+ codec: ICodecType;
4388
+ defaultDefinition: string;
4389
+ }>;
4390
+ getVideos(): Promise<any>;
4391
+ getPrivateDrmInfo(playList: Stream[], vid: string, streamType: string): Promise<void>;
4392
+ getThumbnailConfig(thumbs: IThumbInfoItem[]): void;
4393
+ getBarrageMaskUrl(url: string): void;
4394
+ getDrmConfig(videoInfo: IVideoInfo): void;
4395
+ init(): void;
4396
+ initConfig(getVideoByToken: IPlayAuthTokenConfig): void;
4397
+ /**
4398
+ * @description 更新playAuthToken
4399
+ * @param {IPlayAuthTokenConfig} getVideoByToken token信息
4400
+ * @param {boolean} isNewVideo 是否新视频,即是否为切换视频
4401
+ */
4402
+ updateAuthToken(getVideoByToken: IPlayAuthTokenConfig, isNewVideo: boolean): Promise<void>;
4403
+ checkPlayAuthTokenValid(): boolean;
4404
+ checkKeyTokenValid(): boolean;
4405
+ checkDrmAuthTokenValid(): boolean;
4406
+ }
4154
4407
  /** {zh}
4155
4408
  * @hidden
4156
4409
  */
@@ -4192,6 +4445,8 @@ declare abstract class AbstractBaseAdapter {
4192
4445
  abstract adaptRangeDefaultOptions(): IAdaptRangeDefaultOptions | undefined;
4193
4446
  abstract applyAdaptRangePluginConfig(_finalOptions: any, _adaptRangeOptions: any): void;
4194
4447
  abstract applyAdaptRangeStrategy(_finalOptions: any, _adaptRangeOptions: any): void;
4448
+ abstract getPlugins(umdLoader: UMDLoader): Promise<XGPlugin[]>;
4449
+ abstract setPluginConfigInVid(videoInfo: IVideoInfo, context: AuthToken): void;
4195
4450
  }
4196
4451
  declare class PlayerData {
4197
4452
  id?: string;
@@ -4207,7 +4462,7 @@ declare class PlayerData {
4207
4462
  openSoftDecoding: boolean;
4208
4463
  defaultConfig: IDefaultConfig | undefined;
4209
4464
  isHitDefault: boolean;
4210
- codec?: `${CodecType}`;
4465
+ codec?: ICodecType;
4211
4466
  enableH265Degrade: boolean;
4212
4467
  languageData: {
4213
4468
  extraLangList: IXGI18nText[];
@@ -4238,12 +4493,25 @@ declare class PlayerData {
4238
4493
  };
4239
4494
  private isAutoBitrateEnable;
4240
4495
  adapter: AbstractBaseAdapter;
4241
- isBusinessDrm: boolean;
4242
- isEncrypt: boolean;
4496
+ /**
4497
+ * @breif 是否vid模式的加密播放
4498
+ */
4499
+ isVidEncrypt: boolean;
4243
4500
  dashOpts: {
4244
4501
  Data: IGetPlayInfoRes;
4245
4502
  };
4503
+ /**
4504
+ * @brief 播放器sdk实例
4505
+ */
4246
4506
  sdk: VePlayer;
4507
+ /**
4508
+ * @brief 当前加密播放类型,为空则表示非加密
4509
+ */
4510
+ drmType: EDRMTYPE;
4511
+ /**
4512
+ * @brief 私有加密会话id
4513
+ */
4514
+ encryptSessionId?: string;
4247
4515
  constructor(configs: IPlayerConfig & {
4248
4516
  licensSupportModuleList: string[];
4249
4517
  }, sdk: VePlayer);
@@ -4260,6 +4528,7 @@ declare class PlayerData {
4260
4528
  playList: Stream[];
4261
4529
  };
4262
4530
  isCurrentH265(): boolean;
4531
+ setDrmType(drmType: EDRMTYPE): void;
4263
4532
  getCurrentByDefaultConfig(): Stream;
4264
4533
  initCurrent(currentStreams: Stream): void;
4265
4534
  initCheckExpireData(): void;
@@ -4372,80 +4641,6 @@ declare class MobilePlayerPanel {
4372
4641
  bind(event: string, eventHandle: any, isBubble?: boolean): void;
4373
4642
  destroy(): void;
4374
4643
  }
4375
- declare enum UmdKeys {
4376
- HLS = "hls",
4377
- FLV = "flv",
4378
- XGVideo = "XGVideo",
4379
- HLSEncrypt = "hlsEncrypt",
4380
- DASH = "dash",
4381
- MP4Encrypt = "mp4Encrypt",
4382
- DanmuJS = "danmujs",
4383
- DanmuMask = "danmuMask",
4384
- StreamProbe = "streamprobe",
4385
- VeStrategy = "vestrategy",
4386
- VeStrategyH265 = "vestrategy_h265",
4387
- VeStrategyPreload = "vestrategy_preload",
4388
- VeStrategyAdaptRange = "vestrategy_adapt_range",
4389
- DashAbralgo = "DashAbralgo",
4390
- Preloader = "preloader"
4391
- }
4392
- /**
4393
- * @hidden
4394
- * @breif umdmap 配置
4395
- */
4396
- export declare type UMDMap = Record<UmdKeys, {
4397
- /**
4398
- * umd Module 的名称,即在window下暴露的接口名称
4399
- */
4400
- name: string;
4401
- /**
4402
- * 对应umd文件名,只用来标记,实际不使用
4403
- */
4404
- pluginName?: string;
4405
- /**
4406
- * 对应npm包的名称,在打包文件时,会在libd.config.js中onPostBuild的钩子中会用于寻找对应npm包
4407
- */
4408
- packageName: string;
4409
- /**
4410
- * npm包中umd入口文件路径,用于打包上传到cdn目录
4411
- */
4412
- devPath: string;
4413
- }>;
4414
- declare class umdLoader {
4415
- private static jsLoadMap;
4416
- private static jsLoadPromiseMap;
4417
- umdMap: UMDMap;
4418
- backupUmdUrlMap: Record<string, string>;
4419
- failCallback: (umdName: string, err: any) => any;
4420
- region: TRegionType;
4421
- customPluginPublicPath: string;
4422
- importedPlugins: any[];
4423
- constructor();
4424
- /**
4425
- * @return { string } 插件加载的公共路径
4426
- */
4427
- get pluginPublicPath(): string;
4428
- /**
4429
- * 更新umd的备用地址
4430
- * @param {Record<string, string>} map 备用地址map
4431
- */
4432
- updateBackupMap(map: Record<string, string>): void;
4433
- /**
4434
- * 加载额外的js-sdk
4435
- * 适用 umd 模块
4436
- * 只能浏览器环境下使用
4437
- * @param url 额外加载JS 的 CDN 地址
4438
- * @param isJs 是否js文件
4439
- */
4440
- loadExtraCdn(url: string, isJs?: boolean): Promise<void>;
4441
- /**
4442
- * @description 加载xgplayer插件
4443
- * @param pluginName 插件名称
4444
- * @param successCallback 加载完成后执行的回调
4445
- * @return Promise<any>
4446
- */
4447
- loadPlugins(pluginName: UmdKeys, successCallback?: () => void): Promise<any>;
4448
- }
4449
4644
  export interface IlicenseContent {
4450
4645
  content: string;
4451
4646
  sign: string;
@@ -4494,6 +4689,23 @@ export declare type PlayerCore = Player & {
4494
4689
  licenseType: LicenseEdition;
4495
4690
  };
4496
4691
  };
4692
+ /**
4693
+ * @brief 加密混淆信息
4694
+ */
4695
+ export interface EncryptInfo {
4696
+ /**
4697
+ * @breif 会话ID
4698
+ */
4699
+ sessionId: string;
4700
+ /**
4701
+ * @brief 混淆后的公钥
4702
+ */
4703
+ drmKeK: string;
4704
+ /**
4705
+ * @breif 唯一身份信息
4706
+ */
4707
+ unionInfo: string;
4708
+ }
4497
4709
  declare class VePlayer {
4498
4710
  /** {zh}
4499
4711
  * @brief 播放相关配置数据
@@ -4596,7 +4808,7 @@ declare class VePlayer {
4596
4808
  * @type {*}
4597
4809
  * @memberof VePlayer
4598
4810
  */
4599
- sdkUmdLoader: umdLoader;
4811
+ sdkUmdLoader: UMDLoader;
4600
4812
  private adapter;
4601
4813
  /**
4602
4814
  * @hidden
@@ -4616,10 +4828,16 @@ declare class VePlayer {
4616
4828
  * @memberof VePlayer
4617
4829
  */
4618
4830
  static sdkVersion: string;
4831
+ /**
4832
+ * @hidden
4833
+ * @private 私有加密会话id
4834
+ */
4835
+ private static privateEncryptSessionId;
4619
4836
  /**
4620
4837
  * @hidden
4621
4838
  */
4622
4839
  private veErrorIns;
4840
+ private vodLogCommon;
4623
4841
  /** {zh}
4624
4842
  * @brief 播放策略预初始化配置
4625
4843
  * @param options 初始化配置,详情见{@link StrategyInitOptions}
@@ -4666,7 +4884,12 @@ declare class VePlayer {
4666
4884
  static checkModuleList(): Promise<string[]>;
4667
4885
  static checkLicenseStatus(): Promise<LicenseStatus>;
4668
4886
  static checkLicenseModuleAuth(module: string, featureName: LicenseFeature): Promise<boolean>;
4669
- private static vodLogCommon;
4887
+ /**
4888
+ * @breif 生成加密混淆的数据信息
4889
+ * @param unionId 用户唯一id
4890
+ * @param streamType 私有加密视频的格式/协议,取值有:hls、mp4、dash。
4891
+ */
4892
+ static generateEncryptInfo(unionId: string, streamType: "hls" | "mp4" | "dash"): Promise<EncryptInfo | undefined>;
4670
4893
  private static hasInitVeStrategy;
4671
4894
  /**
4672
4895
  * @hidden
@@ -4709,10 +4932,16 @@ declare class VePlayer {
4709
4932
  private _initCheckExpire;
4710
4933
  /**
4711
4934
  * @hidden
4712
- * @description 更新umdLoader 的配置
4935
+ * @description 初始化umdLoader 的配置
4713
4936
  * @memberof VePlayer
4714
4937
  */
4715
4938
  private initUmdLoader;
4939
+ /**
4940
+ * @hidden
4941
+ * @description 更新umdLoader 的配置
4942
+ * @memberof VePlayer
4943
+ */
4944
+ private updateUmdLoader;
4716
4945
  /**
4717
4946
  * @hidden
4718
4947
  * @private
@@ -4772,7 +5001,10 @@ declare class VePlayer {
4772
5001
  /** {en}
4773
5002
  * @hidden
4774
5003
  */
4775
- renderDom(): void;
5004
+ renderDom({ id, root }: {
5005
+ id: any;
5006
+ root: any;
5007
+ }): void;
4776
5008
  /** {zh}
4777
5009
  * @hidden
4778
5010
  *
@@ -5059,7 +5291,7 @@ declare class VePlayer {
5059
5291
  getSoftDecodingOption(isOpenSoftDecoding: boolean, url: string, type: string): Promise<{
5060
5292
  mediaType?: string;
5061
5293
  innerDegrade?: number;
5062
- codecType?: `${CodecType}`;
5294
+ codecType?: ICodecType;
5063
5295
  plugins?: any[];
5064
5296
  }>;
5065
5297
  /** {zh}
@@ -5530,6 +5762,59 @@ export declare class Subtitle extends Plugin {
5530
5762
  destroy(): void;
5531
5763
  render(): string;
5532
5764
  }
5765
+ export declare type AdRuleOffset = "pre" | "post" | `${number}:${number}:${number}`;
5766
+ export declare type AdRuleType = "linear" | "nonlinear";
5767
+ export interface AdRule {
5768
+ offset: AdRuleOffset;
5769
+ tag: string;
5770
+ type: AdRuleType;
5771
+ }
5772
+ export interface AdsConfig {
5773
+ controls?: boolean;
5774
+ enableSCTE35?: boolean;
5775
+ replayForSCTE35?: {
5776
+ enable?: boolean;
5777
+ minDurationOffset?: number;
5778
+ };
5779
+ adType: "ima" | "google-ima" | "ssai";
5780
+ ima: AdsPluginConfig["ima"] & {
5781
+ schedule?: AdRule[];
5782
+ adTagUrlForSCTE35?: string;
5783
+ };
5784
+ }
5785
+ export declare class AdsPlugin extends XGAdsPlugin {
5786
+ config: AdsConfig;
5787
+ csManager: any;
5788
+ player: any;
5789
+ root: any;
5790
+ private _scte35Manager?;
5791
+ private _ssManager?;
5792
+ private _onPlay?;
5793
+ private _onTimeUpdate?;
5794
+ private _onPause?;
5795
+ private _onError?;
5796
+ private _onClick?;
5797
+ static get pluginName(): string;
5798
+ get adManager(): any;
5799
+ afterCreate(): void;
5800
+ afterPlayerInit(): void;
5801
+ beforePlayerInit(): Promise<any>;
5802
+ destroy(): void;
5803
+ private _clearSSAIListener;
5804
+ private _setupSSAIListener;
5805
+ private _dispatchEvent;
5806
+ private _init;
5807
+ /**
5808
+ * Preroll广告播放完,retry重新拉流保证启播延迟
5809
+ */
5810
+ /**
5811
+ * 如果存在midroll广告,需要将disconnectTime和maxLatency设为最大值,否则currentTime的变化会影响展示时间
5812
+ */
5813
+ /**
5814
+ * 静音播放Preroll广告时,需要显示autoplayPlugin插件的ummute蒙层
5815
+ */
5816
+ private _handlePrerollMuted;
5817
+ }
5533
5818
  export declare class TimeShiftPlugin extends Plugin {
5534
5819
  static get pluginName(): string;
5535
5820
  static get defaultConfig(): {
@@ -5727,54 +6012,6 @@ export declare class LiveInfoPanel extends Plugin {
5727
6012
  close(): void;
5728
6013
  render(): string;
5729
6014
  }
5730
- export declare class SdkPlugin {
5731
- pluginName: string;
5732
- __args: any;
5733
- sdk: VePlayer;
5734
- playerData: PlayerData;
5735
- player: Player;
5736
- _emitter: EventEmitter;
5737
- static defineGetterOrSetter(Obj: any, map: any): void;
5738
- /**
5739
- * @type { string }
5740
- */
5741
- static get pluginName(): string;
5742
- /**
5743
- * @constructor
5744
- * @param { { sdk: object, pluginName: string, [propName: string]: any;} } args
5745
- */
5746
- constructor(args: any);
5747
- /**
5748
- * @description sdk实例创建,挂载插件实例时首先执行
5749
- */
5750
- beforeCreate(): void;
5751
- /**
5752
- * @description sdk实例创建,挂载插件实例完后执行
5753
- */
5754
- afterCreate(): void;
5755
- /**
5756
- * @description sdk创建播放器前执行,只有这里能保证异步操作在creatPlayer之前同步完成
5757
- */
5758
- beforePlayerCreate(): void;
5759
- /**
5760
- * @description sdk创建播放器完执行
5761
- */
5762
- afterPlayerCreate(): void;
5763
- /**
5764
- * @description sdk销毁时执行
5765
- */
5766
- destroy(): void;
5767
- /**
5768
- * @private
5769
- * @param { any } args
5770
- */
5771
- __init(args: any): void;
5772
- /**
5773
- * @description 插件销毁
5774
- * @private
5775
- */
5776
- __destroy(): void;
5777
- }
5778
6015
  export declare const Events: {
5779
6016
  /** {zh}
5780
6017
  * @brief 弹幕配置发生变化。