Skip to content

Commit

Permalink
Deploy to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 1, 2024
1 parent 486b4cb commit 6f11312
Show file tree
Hide file tree
Showing 172 changed files with 2,276 additions and 4,223 deletions.
17 changes: 17 additions & 0 deletions assets/ts/artplayer-plugin-auto-thumbnail.d.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions assets/ts/artplayer-plugin-chapter.d.ts
Original file line number Diff line number Diff line change
@@ -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;
69 changes: 55 additions & 14 deletions assets/ts/artplayer-plugin-danmuku.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
/**
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -116,6 +122,11 @@ type Option = {
flattening?: number;
};

/**
* 当播放器宽度小于此值时,弹幕发射器置于播放器底部
*/
width?: number;

/**
* 热力图数据
*/
Expand All @@ -141,6 +152,11 @@ type Option = {
*/
visible?: boolean;

/**
* 是否开启弹幕发射器
*/
emitter?: boolean;

/**
* 弹幕输入框最大长度, 范围在[1 ~ 1000]
*/
Expand All @@ -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;

/**
* 挂载弹幕输入框
Expand All @@ -193,7 +234,7 @@ type Danmuku = {
/**
* 重置弹幕
*/
reset: () => Danmuku;
reset: () => Result;

/**
* 弹幕配置
Expand All @@ -211,4 +252,4 @@ type Danmuku = {
isStop: boolean;
};

declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Danmuku;
declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Result;
20 changes: 20 additions & 0 deletions assets/ts/artplayer-plugin-vast.d.ts
Original file line number Diff line number Diff line change
@@ -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;
90 changes: 62 additions & 28 deletions assets/ts/artplayer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export type Utils = {
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 = {
Expand Down Expand Up @@ -286,6 +290,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;
Expand All @@ -295,7 +301,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;
Expand All @@ -312,6 +318,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
Expand Down Expand Up @@ -483,6 +521,11 @@ export type Option = {
*/
airplay?: boolean;

/**
* Custom video proxy
*/
proxy?: (this: Artplayer, art: Artplayer) => HTMLCanvasElement | HTMLVideoElement;

/**
* Custom plugin list
*/
Expand Down Expand Up @@ -531,32 +574,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
Expand Down Expand Up @@ -685,6 +703,8 @@ export type I18n = Record<I18nKeys, Partial<I18nValue>>;



export type Bar = 'loaded' | 'played' | 'hover';

export type Events = {
'video:canplay': [event: Event];
'video:canplaythrough': [event: Event];
Expand Down Expand Up @@ -749,6 +769,7 @@ export type Events = {
subtitleOffset: [offset: number];
restart: [url: string];
muted: [state: boolean];
setBar: [type: Bar, percentage: number, event?: Event];
};

export type CssVar = {
Expand Down Expand Up @@ -1019,6 +1040,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;
Expand All @@ -1032,6 +1066,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;
Expand Down Expand Up @@ -1107,7 +1142,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;
};

Expand Down
Loading

0 comments on commit 6f11312

Please sign in to comment.