From 5f59c45891a4e3507890d47c922ac3010c9b3a04 Mon Sep 17 00:00:00 2001 From: kanno <812137533@qq.com> Date: Thu, 27 Jan 2022 20:33:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=8A=A0=E5=85=A5=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.d.ts | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 dist/index.d.ts diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 00000000..4ef500cf --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,91 @@ +export interface ExtraConfig { + moovStartFlag?: boolean; + rawFps?: number; + autoCrop?: boolean; + core?: 0 | 1; + coreProbePart?: number; + ignoreAudio?: 0 | 1; + probeSize?: number; +} + +export interface Web265JsConfig { + /** + *The type of the file to be played, do not fill in the automatic identification + */ + type?: "mp4" | "hls" | "ts" | "raw265" | "flv"; + /** + * playback window dom id value + */ + player: string; + /** + * the video window width size + */ + width: number; + /** + * the video window height size + */ + height: number; + /** + * player token value + */ + token: string; + extInfo?: ExtraConfig; +} + +export interface Web265JsMediaInfo { + audioNone: boolean; + durationMs: number; + fps: number; + sampleRate: number; + size: { + height: number; + width: number; + }; + videoCodec: 0 | 1; + isHEVC: boolean; + videoType: Web265JsConfig["type"]; +} + +interface New265WebJs { + onSeekFinish(): void; + onRender: ( + width: number, + height: number, + imageBufferY: typeof Uint8Array, + imageBufferB: typeof Uint8Array, + imageBufferR: typeof Uint8Array + ) => void; + onLoadFinish(): void; + onPlayTime(videoPTS: number): void; + onPlayFinish(): void; + onCacheProcess(cPts: number): void; + onReadyShowDone(): void; + onLoadCache(): void; + onLoadCacheFinshed(): void; + onOpenFullScreen(): void; + onCloseFullScreen(): void; + do(): void; + pause(): void; + isPlaying(): boolean; + setRenderScreen(state: boolean): void; + seek(pts: number): void; + setVoice(volume: number): void; + mediaInfo(): Web265JsMediaInfo; + fullScreen(): void; + closeFullScreen(): void; + release(): void; +} + +declare type new265webJsFn = ( + url: string, + config: Web265JsConfig +) => New265WebJs; + +interface Window { + new265webjs: new265webJsFn; +} + +export default class H265webjsModule { + static createPlayer: (url: string, config: Web265JsConfig) => New265WebJs; + static clear(): void; +}