mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11: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
@@ -47,17 +47,21 @@
|
||||
});
|
||||
|
||||
var libUris = [
|
||||
'./assets/ts/artplayer.d.ts',
|
||||
'./assets/ts/artplayer-plugin-ads.d.ts',
|
||||
'./assets/ts/artplayer-plugin-control.d.ts',
|
||||
'./assets/ts/artplayer-plugin-danmuku.d.ts',
|
||||
'./assets/ts/artplayer-plugin-dash-quality.d.ts',
|
||||
'./assets/ts/artplayer-plugin-hls-quality.d.ts',
|
||||
'./assets/ts/artplayer-plugin-iframe.d.ts',
|
||||
'./assets/ts/artplayer-plugin-ambilight.d.ts',
|
||||
'./assets/ts/artplayer-plugin-auto-thumbnail.d.ts',
|
||||
'./assets/ts/artplayer-plugin-chapter.d.ts',
|
||||
'./assets/ts/artplayer-plugin-chromecast.d.ts',
|
||||
'./assets/ts/artplayer-plugin-danmuku-mask.d.ts',
|
||||
'./assets/ts/artplayer-plugin-danmuku.d.ts',
|
||||
'./assets/ts/artplayer-plugin-dash-control.d.ts',
|
||||
'./assets/ts/artplayer-plugin-hls-control.d.ts',
|
||||
'./assets/ts/artplayer-plugin-iframe.d.ts',
|
||||
'./assets/ts/artplayer-plugin-libass.d.ts',
|
||||
'./assets/ts/artplayer-plugin-multiple-subtitles.d.ts',
|
||||
'./assets/ts/artplayer-plugin-vast.d.ts',
|
||||
'./assets/ts/artplayer-plugin-vtt-thumbnail.d.ts',
|
||||
'./assets/ts/artplayer.d.ts',
|
||||
];
|
||||
|
||||
for (let index = 0; index < libUris.length; index++) {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginAmbilight;
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
|
||||
type Option = {
|
||||
blur: string;
|
||||
opacity: number;
|
||||
frequency: number;
|
||||
zIndex: number;
|
||||
duration: number;
|
||||
};
|
||||
|
||||
type Result = {
|
||||
name: 'artplayerPluginAmbilight';
|
||||
start: () => void;
|
||||
stop: () => void;
|
||||
};
|
||||
|
||||
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result;
|
||||
@@ -0,0 +1,17 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginAutoThumbnail;
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
|
||||
type Option = {
|
||||
url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
scale?: number;
|
||||
};
|
||||
|
||||
type Result = {
|
||||
name: 'artplayerPluginAutoThumbnail';
|
||||
};
|
||||
|
||||
declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) => Result;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginChapter;
|
||||
export as namespace artplayerPluginChapter;
|
||||
|
||||
type Chapters = {
|
||||
start: number;
|
||||
end: number;
|
||||
title: string;
|
||||
}[];
|
||||
|
||||
type Option = {
|
||||
chapters?: Chapters;
|
||||
};
|
||||
|
||||
type Result = {
|
||||
name: 'artplayerPluginChapter';
|
||||
update: (option: Option) => void;
|
||||
};
|
||||
|
||||
declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Result;
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginControl;
|
||||
export as namespace artplayerPluginControl;
|
||||
|
||||
type Option = {};
|
||||
|
||||
type Control = {
|
||||
name: 'artplayerPluginControl';
|
||||
enable: Boolean;
|
||||
};
|
||||
|
||||
declare const artplayerPluginControl: (option?: Option) => (art: Artplayer) => Control;
|
||||
@@ -0,0 +1,25 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginDanmukuMask;
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
|
||||
type Option = {
|
||||
solutionPath?: string;
|
||||
modelSelection?: number;
|
||||
smoothSegmentation?: boolean;
|
||||
minDetectionConfidence?: number;
|
||||
minTrackingConfidence?: number;
|
||||
selfieMode?: boolean;
|
||||
drawContour?: boolean;
|
||||
foregroundThreshold?: number;
|
||||
opacity?: number;
|
||||
maskBlurAmount?: number;
|
||||
};
|
||||
|
||||
type Result = {
|
||||
name: 'artplayerPluginDanmukuMask';
|
||||
start: () => Promise<void>;
|
||||
stop: () => void;
|
||||
};
|
||||
|
||||
declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer) => Result;
|
||||
+55
-14
@@ -4,6 +4,17 @@ export = artplayerPluginDanmuku;
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
|
||||
type Mode = 0 | 1 | 2;
|
||||
type Danmuku = Danmu[] | string | (() => Promise<Danmu[]>) | Promise<Danmu[]>;
|
||||
|
||||
type Slider = {
|
||||
min: number;
|
||||
max: number;
|
||||
steps: {
|
||||
name?: string;
|
||||
value?: any;
|
||||
show?: boolean;
|
||||
}[];
|
||||
};
|
||||
|
||||
type Danmu = {
|
||||
/**
|
||||
@@ -35,18 +46,13 @@ type Danmu = {
|
||||
* 弹幕自定义样式
|
||||
*/
|
||||
style?: Partial<CSSStyleDeclaration>;
|
||||
|
||||
/**
|
||||
* 弹幕文本是否转义, 默认为 true
|
||||
*/
|
||||
escape?: boolean;
|
||||
};
|
||||
|
||||
type Option = {
|
||||
/**
|
||||
* 弹幕数据: 函数,数组,Promise,URL
|
||||
*/
|
||||
danmuku: Danmu[] | string | (() => Promise<Danmu[]>) | Promise<Danmu[]>;
|
||||
danmuku: Danmuku;
|
||||
|
||||
/**
|
||||
* 弹幕持续时间,范围在[1 ~ 10]
|
||||
@@ -116,6 +122,11 @@ type Option = {
|
||||
flattening?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* 当播放器宽度小于此值时,弹幕发射器置于播放器底部
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* 热力图数据
|
||||
*/
|
||||
@@ -141,6 +152,11 @@ type Option = {
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* 是否开启弹幕发射器
|
||||
*/
|
||||
emitter?: boolean;
|
||||
|
||||
/**
|
||||
* 弹幕输入框最大长度, 范围在[1 ~ 1000]
|
||||
*/
|
||||
@@ -155,35 +171,60 @@ type Option = {
|
||||
* 弹幕主题,只在自定义挂载时生效
|
||||
*/
|
||||
theme?: 'light' | 'dark';
|
||||
|
||||
/**
|
||||
* 不透明度配置项
|
||||
*/
|
||||
OPACITY?: Slider;
|
||||
|
||||
/**
|
||||
* 弹幕速度配置项
|
||||
*/
|
||||
SPEED?: Slider;
|
||||
|
||||
/**
|
||||
* 显示区域配置项
|
||||
*/
|
||||
MARGIN?: Slider;
|
||||
|
||||
/**
|
||||
* 弹幕字号配置项
|
||||
*/
|
||||
FONT_SIZE?: Slider;
|
||||
|
||||
/**
|
||||
* 颜色列表配置项
|
||||
*/
|
||||
COLOR?: string[];
|
||||
};
|
||||
|
||||
type Danmuku = {
|
||||
type Result = {
|
||||
name: 'artplayerPluginDanmuku';
|
||||
|
||||
/**
|
||||
* 发送一条实时弹幕
|
||||
*/
|
||||
emit: (danmu: Danmu) => Danmuku;
|
||||
emit: (danmu: Danmu) => Result;
|
||||
|
||||
/**
|
||||
* 重载弹幕源,或者切换新弹幕
|
||||
*/
|
||||
load: () => Promise<Danmuku>;
|
||||
load: (danmuku?: Danmuku) => Promise<Result>;
|
||||
|
||||
/**
|
||||
* 实时改变弹幕配置
|
||||
*/
|
||||
config: (option: Option) => Danmuku;
|
||||
config: (option: Option) => Result;
|
||||
|
||||
/**
|
||||
* 隐藏弹幕层
|
||||
*/
|
||||
hide: () => Danmuku;
|
||||
hide: () => Result;
|
||||
|
||||
/**
|
||||
* 显示弹幕层
|
||||
*/
|
||||
show: () => Danmuku;
|
||||
show: () => Result;
|
||||
|
||||
/**
|
||||
* 挂载弹幕输入框
|
||||
@@ -193,7 +234,7 @@ type Danmuku = {
|
||||
/**
|
||||
* 重置弹幕
|
||||
*/
|
||||
reset: () => Danmuku;
|
||||
reset: () => Result;
|
||||
|
||||
/**
|
||||
* 弹幕配置
|
||||
@@ -211,4 +252,4 @@ type Danmuku = {
|
||||
isStop: boolean;
|
||||
};
|
||||
|
||||
declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Danmuku;
|
||||
declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Result;
|
||||
@@ -0,0 +1,17 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginDashControl;
|
||||
export as namespace artplayerPluginDashControl;
|
||||
|
||||
type Config = {
|
||||
control?: boolean;
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getName?(level: object): String;
|
||||
};
|
||||
|
||||
declare const artplayerPluginDashControl: (option: { quality?: Config; audio?: Config }) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginDashControl';
|
||||
update: () => void;
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginDashQuality;
|
||||
export as namespace artplayerPluginDashQuality;
|
||||
|
||||
declare const artplayerPluginDashQuality: (option: {
|
||||
control?: boolean;
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getResolution?(level: any): String;
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginDashQuality';
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginHlsControl;
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
|
||||
type Config = {
|
||||
control?: boolean;
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getName?(level: object): String;
|
||||
};
|
||||
|
||||
declare const artplayerPluginHlsControl: (option: { quality?: Config; audio?: Config }) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginHlsControl';
|
||||
update: () => void;
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginHlsQuality;
|
||||
export as namespace artplayerPluginHlsQuality;
|
||||
|
||||
declare const artplayerPluginHlsQuality: (option: {
|
||||
control?: boolean;
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getResolution?(level: any): String;
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginHlsQuality';
|
||||
};
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginVast;
|
||||
export as namespace artplayerPluginVast;
|
||||
|
||||
type Option = (params: {
|
||||
art: Artplayer;
|
||||
id: string;
|
||||
ima: any;
|
||||
imaPlayer: any;
|
||||
$container: HTMLDivElement;
|
||||
playUrl: (url: string) => void;
|
||||
playRes: (res: string) => void;
|
||||
}) => void;
|
||||
|
||||
type Result = {
|
||||
name: 'artplayerPluginVast';
|
||||
};
|
||||
|
||||
declare const artplayerPluginVast: (option: Option) => (art: Artplayer) => Result;
|
||||
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