mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
chore: 删除不再使用的 TypeScript 声明文件,并添加新的插件声明文件
This commit is contained in:
1 parent
57d6f25e5b
commit
3a052a60e3
15 files changed
+315
-132
No files matched your search
Vendored
+81
-38
@@ -49,8 +49,11 @@ export type Utils = {
|
||||
secondToTime(second: number): string;
|
||||
escape(str: string): string;
|
||||
capitalize(str: string): string;
|
||||
isStringOrNumber(val: any): boolean;
|
||||
getIcon(key: string, html: string | HTMLElement): HTMLElement;
|
||||
supportsFlex(): boolean;
|
||||
setStyleText(element: HTMLElement, text: string): void;
|
||||
getRect(el: HTMLElement): { top: number; left: number; width: number; height: number };
|
||||
loadImg(url: string, scale?: Number): Promise<HTMLImageElement>;
|
||||
};
|
||||
|
||||
export type Template = {
|
||||
@@ -124,13 +127,17 @@ type Props<T> = {
|
||||
html: string;
|
||||
icon: string;
|
||||
tooltip: string;
|
||||
$item: HTMLDivElement;
|
||||
$icon: HTMLDivElement;
|
||||
$html: HTMLDivElement;
|
||||
$tooltip: HTMLDivElement;
|
||||
$switch: boolean;
|
||||
$switch: HTMLDivElement;
|
||||
$range: HTMLInputElement;
|
||||
$parentItem: Setting;
|
||||
$parentList: Setting[];
|
||||
$parent: Setting;
|
||||
$parents: Setting[];
|
||||
$option: Setting[];
|
||||
$events: Function[];
|
||||
$formatted: boolean;
|
||||
} & Omit<T, 'html' | 'icon' | 'tooltip'>;
|
||||
|
||||
export type SettingOption = Props<Setting>;
|
||||
@@ -286,6 +293,8 @@ export declare class Player {
|
||||
set subtitleOffset(time: number);
|
||||
set switch(url: string);
|
||||
set quality(quality: quality[]);
|
||||
get thumbnails(): Thumbnails;
|
||||
set thumbnails(thumbnails: Thumbnails);
|
||||
pause(): void;
|
||||
play(): Promise<void>;
|
||||
toggle(): void;
|
||||
@@ -295,7 +304,7 @@ export declare class Player {
|
||||
switchQuality(url: string): Promise<void>;
|
||||
getDataURL(): Promise<string>;
|
||||
getBlobUrl(): Promise<string>;
|
||||
screenshot(): Promise<string>;
|
||||
screenshot(name?: string): Promise<string>;
|
||||
airplay(): void;
|
||||
autoSize(): void;
|
||||
autoHeight(): void;
|
||||
@@ -312,6 +321,38 @@ export declare class Player {
|
||||
|
||||
export type CustomType = 'flv' | 'm3u8' | 'hls' | 'ts' | 'mpd' | 'torrent' | (string & Record<never, never>);
|
||||
|
||||
export type Thumbnails = {
|
||||
/**
|
||||
* The thumbnail image url
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* The thumbnail item number
|
||||
*/
|
||||
number?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail column size
|
||||
*/
|
||||
column?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail width
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail height
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail scale
|
||||
*/
|
||||
scale?: number;
|
||||
};
|
||||
|
||||
export type Option = {
|
||||
/**
|
||||
* The player id
|
||||
@@ -483,6 +524,11 @@ export type Option = {
|
||||
*/
|
||||
airplay?: boolean;
|
||||
|
||||
/**
|
||||
* Custom video proxy
|
||||
*/
|
||||
proxy?: (this: Artplayer, art: Artplayer) => HTMLCanvasElement | HTMLVideoElement;
|
||||
|
||||
/**
|
||||
* Custom plugin list
|
||||
*/
|
||||
@@ -531,32 +577,7 @@ export type Option = {
|
||||
/**
|
||||
* Custom thumbnail
|
||||
*/
|
||||
thumbnails?: {
|
||||
/**
|
||||
* The thumbnail image url
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* The thumbnail item number
|
||||
*/
|
||||
number?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail column size
|
||||
*/
|
||||
column?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail width
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* The thumbnail height
|
||||
*/
|
||||
height?: number;
|
||||
};
|
||||
thumbnails?: Thumbnails;
|
||||
|
||||
/**
|
||||
* Custom subtitle option
|
||||
@@ -640,6 +661,7 @@ type I18nKeys =
|
||||
| 'id'
|
||||
| 'ru'
|
||||
| 'tr'
|
||||
| 'ar'
|
||||
| (string & Record<never, never>);
|
||||
|
||||
type I18nValue = {
|
||||
@@ -685,6 +707,9 @@ export type I18n = Record<I18nKeys, Partial<I18nValue>>;
|
||||
|
||||
|
||||
|
||||
|
||||
export type Bar = 'loaded' | 'played' | 'hover';
|
||||
|
||||
export type Events = {
|
||||
'video:canplay': [event: Event];
|
||||
'video:canplaythrough': [event: Event];
|
||||
@@ -719,9 +744,10 @@ export type Events = {
|
||||
setting: [state: boolean];
|
||||
hotkey: [event: Event];
|
||||
destroy: [];
|
||||
subtitleUpdate: [text: string];
|
||||
subtitleLoad: [url: string];
|
||||
subtitleSwitch: [url: string];
|
||||
subtitleOffset: [offset: number];
|
||||
subtitleBeforeUpdate: [cue: VTTCue];
|
||||
subtitleAfterUpdate: [cue: VTTCue];
|
||||
subtitleLoad: [cues: VTTCue[], option: Subtitle];
|
||||
focus: [event: Event];
|
||||
blur: [event: Event];
|
||||
dblclick: [event: Event];
|
||||
@@ -746,9 +772,10 @@ export type Events = {
|
||||
play: [];
|
||||
screenshot: [dataUri: string];
|
||||
seek: [currentTime: number];
|
||||
subtitleOffset: [offset: number];
|
||||
restart: [url: string];
|
||||
muted: [state: boolean];
|
||||
setBar: [type: Bar, percentage: number, event?: Event];
|
||||
keydown: [event: KeyboardEvent];
|
||||
};
|
||||
|
||||
export type CssVar = {
|
||||
@@ -1019,6 +1046,19 @@ export as namespace Artplayer;
|
||||
declare class Artplayer extends Player {
|
||||
constructor(option: Option, readyCallback?: (this: Artplayer, art: Artplayer) => unknown);
|
||||
|
||||
get Config(): Config;
|
||||
get Events(): Events;
|
||||
get Utils(): Utils;
|
||||
get Player(): Player;
|
||||
get Option(): Option;
|
||||
get Subtitle(): Subtitle;
|
||||
get Icons(): Icons;
|
||||
get Template(): Template;
|
||||
get I18n(): I18n;
|
||||
get Setting(): Setting;
|
||||
get SettingOption(): SettingOption;
|
||||
get Component(): Component;
|
||||
|
||||
static readonly instances: Artplayer[];
|
||||
static readonly version: string;
|
||||
static readonly env: string;
|
||||
@@ -1032,6 +1072,7 @@ declare class Artplayer extends Player {
|
||||
static readonly html: Artplayer['template']['html'];
|
||||
static readonly option: Option;
|
||||
|
||||
static STYLE: string;
|
||||
static DEBUG: boolean;
|
||||
static CONTEXTMENU: boolean;
|
||||
static NOTICE_TIME: number;
|
||||
@@ -1107,7 +1148,6 @@ declare class Artplayer extends Player {
|
||||
options?: boolean | AddEventListenerOptions,
|
||||
): () => void;
|
||||
hover(element: HTMLElement, mouseenter?: (event: Event) => any, mouseleave?: (event: Event) => any): void;
|
||||
loadImg(element: HTMLImageElement | string): Promise<HTMLImageElement>;
|
||||
remove(event: Event): void;
|
||||
};
|
||||
|
||||
@@ -1142,6 +1182,9 @@ declare class Artplayer extends Player {
|
||||
readonly subtitle: {
|
||||
get url(): string;
|
||||
set url(url: string);
|
||||
get textTrack(): TextTrack;
|
||||
get activeCues(): VTTCue[];
|
||||
get cues(): VTTCue[];
|
||||
style(name: string | Partial<CSSStyleDeclaration>, value?: string): void;
|
||||
switch(url: string, option?: Subtitle): Promise<string>;
|
||||
} & Component;
|
||||
@@ -1152,8 +1195,8 @@ declare class Artplayer extends Player {
|
||||
|
||||
readonly hotkey: {
|
||||
keys: Record<string, ((event: Event) => any)[]>;
|
||||
add(key: number, callback: (this: Artplayer, event: Event) => any): Artplayer['hotkey'];
|
||||
remove(key: number, callback: Function): Artplayer['hotkey'];
|
||||
add(key: string, callback: (this: Artplayer, event: Event) => any): Artplayer['hotkey'];
|
||||
remove(key: string, callback: Function): Artplayer['hotkey'];
|
||||
};
|
||||
|
||||
readonly mask: Component;
|
||||
|
||||
Reference in new issue
Block a user