mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
build all
Refactor utility functions for improved readability and consistency - Updated compatibility.js to use consistent line endings and formatting. - Refactored component.js for better readability and structure, including consistent use of arrow functions and binding. - Simplified dom.js functions with consistent formatting and improved readability. - Enhanced emitter.js with consistent formatting and arrow function usage. - Streamlined error.js for improved readability and consistency. - Refactored file.js to use consistent formatting and improved readability. - Improved format.js functions for better readability and consistency. - Updated index.js to maintain consistent export formatting. - Refactored property.js for improved readability and consistency. - Enhanced subtitle.js with consistent formatting and improved readability. - Refactored time.js for better readability and consistent formatting. fix: update lint script to target only source files for consistency Revert "fix: restore export statements for various plugins and update type definitions for better clarity" This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f. fix: restore export statements for various plugins and update type definitions for better clarity Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
1 parent
532dd67cfd
commit
35ad9883af
447 files changed
+18248
-17946
No files matched your search
+159
-159
@@ -1,189 +1,189 @@
|
||||
import { Config } from './config';
|
||||
import { Events } from './events';
|
||||
import { Utils } from './utils';
|
||||
import { Player } from './player';
|
||||
import { Option } from './option';
|
||||
import { Subtitle } from './subtitle';
|
||||
import { Icons } from './icons';
|
||||
import { Template } from './template';
|
||||
import { I18n } from './i18n';
|
||||
import { Setting, SettingOption } from './setting';
|
||||
import { Component } from './component';
|
||||
import type { Component } from './component'
|
||||
import type { Config } from './config'
|
||||
import type { Events } from './events'
|
||||
import type { I18n } from './i18n'
|
||||
import type { Icons } from './icons'
|
||||
import type { Option } from './option'
|
||||
import type { Setting, SettingOption } from './setting'
|
||||
import type { Subtitle } from './subtitle'
|
||||
import type { Template } from './template'
|
||||
import type { Utils } from './utils'
|
||||
import { Player } from './player'
|
||||
|
||||
export = Artplayer;
|
||||
export = Artplayer
|
||||
export as namespace Artplayer;
|
||||
|
||||
declare class Artplayer extends Player {
|
||||
constructor(option: Option, readyCallback?: (this: Artplayer, art: Artplayer) => unknown);
|
||||
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;
|
||||
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;
|
||||
static readonly build: string;
|
||||
static readonly config: Config;
|
||||
static readonly utils: Utils;
|
||||
static readonly scheme: Record<keyof Option, any>;
|
||||
static readonly Emitter: Function;
|
||||
static readonly validator: <T extends object>(option: T, scheme: object) => T;
|
||||
static readonly kindOf: (item: any) => string;
|
||||
static readonly html: Artplayer['template']['html'];
|
||||
static readonly option: Option;
|
||||
static readonly instances: Artplayer[]
|
||||
static readonly version: string
|
||||
static readonly env: string
|
||||
static readonly build: string
|
||||
static readonly config: Config
|
||||
static readonly utils: Utils
|
||||
static readonly scheme: Record<keyof Option, any>
|
||||
static readonly Emitter: Function
|
||||
static readonly validator: <T extends object>(option: T, scheme: object) => T
|
||||
static readonly kindOf: (item: any) => string
|
||||
static readonly html: Artplayer['template']['html']
|
||||
static readonly option: Option
|
||||
|
||||
static STYLE: string;
|
||||
static DEBUG: boolean;
|
||||
static CONTEXTMENU: boolean;
|
||||
static NOTICE_TIME: number;
|
||||
static SETTING_WIDTH: number;
|
||||
static SETTING_ITEM_WIDTH: number;
|
||||
static SETTING_ITEM_HEIGHT: number;
|
||||
static RESIZE_TIME: number;
|
||||
static SCROLL_TIME: number;
|
||||
static SCROLL_GAP: number;
|
||||
static AUTO_PLAYBACK_MAX: number;
|
||||
static AUTO_PLAYBACK_MIN: number;
|
||||
static AUTO_PLAYBACK_TIMEOUT: number;
|
||||
static RECONNECT_TIME_MAX: number;
|
||||
static RECONNECT_SLEEP_TIME: number;
|
||||
static CONTROL_HIDE_TIME: number;
|
||||
static DBCLICK_TIME: number;
|
||||
static DBCLICK_FULLSCREEN: boolean;
|
||||
static MOBILE_DBCLICK_PLAY: boolean;
|
||||
static MOBILE_CLICK_PLAY: boolean;
|
||||
static AUTO_ORIENTATION_TIME: number;
|
||||
static INFO_LOOP_TIME: number;
|
||||
static FAST_FORWARD_VALUE: number;
|
||||
static FAST_FORWARD_TIME: number;
|
||||
static TOUCH_MOVE_RATIO: number;
|
||||
static VOLUME_STEP: number;
|
||||
static SEEK_STEP: number;
|
||||
static PLAYBACK_RATE: number[];
|
||||
static ASPECT_RATIO: string[];
|
||||
static FLIP: string[];
|
||||
static FULLSCREEN_WEB_IN_BODY: boolean;
|
||||
static LOG_VERSION: boolean;
|
||||
static USE_RAF: boolean;
|
||||
static STYLE: string
|
||||
static DEBUG: boolean
|
||||
static CONTEXTMENU: boolean
|
||||
static NOTICE_TIME: number
|
||||
static SETTING_WIDTH: number
|
||||
static SETTING_ITEM_WIDTH: number
|
||||
static SETTING_ITEM_HEIGHT: number
|
||||
static RESIZE_TIME: number
|
||||
static SCROLL_TIME: number
|
||||
static SCROLL_GAP: number
|
||||
static AUTO_PLAYBACK_MAX: number
|
||||
static AUTO_PLAYBACK_MIN: number
|
||||
static AUTO_PLAYBACK_TIMEOUT: number
|
||||
static RECONNECT_TIME_MAX: number
|
||||
static RECONNECT_SLEEP_TIME: number
|
||||
static CONTROL_HIDE_TIME: number
|
||||
static DBCLICK_TIME: number
|
||||
static DBCLICK_FULLSCREEN: boolean
|
||||
static MOBILE_DBCLICK_PLAY: boolean
|
||||
static MOBILE_CLICK_PLAY: boolean
|
||||
static AUTO_ORIENTATION_TIME: number
|
||||
static INFO_LOOP_TIME: number
|
||||
static FAST_FORWARD_VALUE: number
|
||||
static FAST_FORWARD_TIME: number
|
||||
static TOUCH_MOVE_RATIO: number
|
||||
static VOLUME_STEP: number
|
||||
static SEEK_STEP: number
|
||||
static PLAYBACK_RATE: number[]
|
||||
static ASPECT_RATIO: string[]
|
||||
static FLIP: string[]
|
||||
static FULLSCREEN_WEB_IN_BODY: boolean
|
||||
static LOG_VERSION: boolean
|
||||
static USE_RAF: boolean
|
||||
|
||||
readonly id: number;
|
||||
readonly option: Option;
|
||||
readonly isLock: boolean;
|
||||
readonly isReady: boolean;
|
||||
readonly isFocus: boolean;
|
||||
readonly isInput: boolean;
|
||||
readonly isRotate: boolean;
|
||||
readonly isDestroy: boolean;
|
||||
readonly id: number
|
||||
readonly option: Option
|
||||
readonly isLock: boolean
|
||||
readonly isReady: boolean
|
||||
readonly isFocus: boolean
|
||||
readonly isInput: boolean
|
||||
readonly isRotate: boolean
|
||||
readonly isDestroy: boolean
|
||||
|
||||
flv: any;
|
||||
m3u8: any;
|
||||
hls: any;
|
||||
ts: any;
|
||||
mpd: any;
|
||||
torrent: any;
|
||||
flv: any
|
||||
m3u8: any
|
||||
hls: any
|
||||
ts: any
|
||||
mpd: any
|
||||
torrent: any
|
||||
|
||||
on<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown;
|
||||
once<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown;
|
||||
emit<T extends keyof Events>(name: T, ...args: unknown[]): unknown;
|
||||
off<T extends keyof Events>(name: T, callback?: Function): unknown;
|
||||
on<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown
|
||||
once<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown
|
||||
emit<T extends keyof Events>(name: T, ...args: unknown[]): unknown
|
||||
off<T extends keyof Events>(name: T, callback?: Function): unknown
|
||||
|
||||
query: Artplayer['template']['query'];
|
||||
proxy: Artplayer['events']['proxy'];
|
||||
video: Artplayer['template']['$video'];
|
||||
query: Artplayer['template']['query']
|
||||
proxy: Artplayer['events']['proxy']
|
||||
video: Artplayer['template']['$video']
|
||||
|
||||
e: Record<keyof Events, { fn: Function; ctx: unknown }[]>;
|
||||
e: Record<keyof Events, { fn: Function, ctx: unknown }[]>
|
||||
|
||||
destroy(removeHtml?: boolean): void;
|
||||
destroy(removeHtml?: boolean): void
|
||||
|
||||
readonly template: {
|
||||
get html(): string;
|
||||
query(str: string): HTMLElement;
|
||||
} & Template;
|
||||
readonly template: {
|
||||
get html(): string
|
||||
query: (str: string) => HTMLElement
|
||||
} & Template
|
||||
|
||||
readonly events: {
|
||||
proxy<KW extends keyof WindowEventMap, KH extends keyof HTMLElementEventMap>(
|
||||
element: HTMLDivElement | Document | Window,
|
||||
eventName: KW | KH,
|
||||
handler: (event: WindowEventMap[KW] | HTMLElementEventMap[KH] | Event) => void,
|
||||
options?: boolean | AddEventListenerOptions,
|
||||
): () => void;
|
||||
hover(element: HTMLElement, mouseenter?: (event: Event) => any, mouseleave?: (event: Event) => any): void;
|
||||
remove(event: Event): void;
|
||||
};
|
||||
readonly events: {
|
||||
proxy: <KW extends keyof WindowEventMap, KH extends keyof HTMLElementEventMap>(
|
||||
element: HTMLDivElement | Document | Window,
|
||||
eventName: KW | KH,
|
||||
handler: (event: WindowEventMap[KW] | HTMLElementEventMap[KH] | Event) => void,
|
||||
options?: boolean | AddEventListenerOptions,
|
||||
) => () => void
|
||||
hover: (element: HTMLElement, mouseenter?: (event: Event) => any, mouseleave?: (event: Event) => any) => void
|
||||
remove: (event: Event) => void
|
||||
}
|
||||
|
||||
readonly storage: {
|
||||
name: String;
|
||||
settings: Record<string, any>;
|
||||
get(key: string): any;
|
||||
set(key: string, value: any): void;
|
||||
del(key: string): boolean;
|
||||
clear(): void;
|
||||
};
|
||||
readonly storage: {
|
||||
name: string
|
||||
settings: Record<string, any>
|
||||
get: (key: string) => any
|
||||
set: (key: string, value: any) => void
|
||||
del: (key: string) => boolean
|
||||
clear: () => void
|
||||
}
|
||||
|
||||
readonly icons: Icons;
|
||||
readonly icons: Icons
|
||||
|
||||
readonly i18n: {
|
||||
readonly languages: I18n;
|
||||
get(key: string): string;
|
||||
update(language: Partial<I18n>): void;
|
||||
};
|
||||
readonly i18n: {
|
||||
readonly languages: I18n
|
||||
get: (key: string) => string
|
||||
update: (language: Partial<I18n>) => void
|
||||
}
|
||||
|
||||
readonly notice: {
|
||||
timer: number;
|
||||
set show(msg: string);
|
||||
};
|
||||
readonly notice: {
|
||||
timer: number
|
||||
set show(msg: string)
|
||||
}
|
||||
|
||||
readonly layers: Record<string, HTMLElement> & Component;
|
||||
readonly layers: Record<string, HTMLElement> & Component
|
||||
|
||||
readonly controls: Record<string, HTMLElement> & Component;
|
||||
readonly controls: Record<string, HTMLElement> & Component
|
||||
|
||||
readonly contextmenu: Record<string, HTMLElement> & Component;
|
||||
readonly contextmenu: Record<string, HTMLElement> & Component
|
||||
|
||||
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;
|
||||
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
|
||||
|
||||
readonly info: Component;
|
||||
readonly info: Component
|
||||
|
||||
readonly loading: Component;
|
||||
readonly loading: Component
|
||||
|
||||
readonly hotkey: {
|
||||
keys: Record<string, ((event: Event) => any)[]>;
|
||||
add(key: string, callback: (this: Artplayer, event: Event) => any): Artplayer['hotkey'];
|
||||
remove(key: string, callback: Function): Artplayer['hotkey'];
|
||||
};
|
||||
readonly hotkey: {
|
||||
keys: Record<string, ((event: Event) => any)[]>
|
||||
add: (key: string, callback: (this: Artplayer, event: Event) => any) => Artplayer['hotkey']
|
||||
remove: (key: string, callback: Function) => Artplayer['hotkey']
|
||||
}
|
||||
|
||||
readonly mask: Component;
|
||||
readonly mask: Component
|
||||
|
||||
readonly setting: {
|
||||
option: SettingOption[];
|
||||
updateStyle(width?: number): void;
|
||||
find(name: string): SettingOption;
|
||||
add(setting: Setting): SettingOption[];
|
||||
update(settings: Setting): SettingOption[];
|
||||
remove(name: string): SettingOption[];
|
||||
} & Component;
|
||||
readonly setting: {
|
||||
option: SettingOption[]
|
||||
updateStyle: (width?: number) => void
|
||||
find: (name: string) => SettingOption
|
||||
add: (setting: Setting) => SettingOption[]
|
||||
update: (settings: Setting) => SettingOption[]
|
||||
remove: (name: string) => SettingOption[]
|
||||
} & Component
|
||||
|
||||
readonly plugins: {
|
||||
add(
|
||||
plugin: (this: Artplayer, art: Artplayer) => any | Promise<any>,
|
||||
): Promise<Artplayer['plugins']> | Artplayer['plugins'];
|
||||
[pluginName: string]: any;
|
||||
};
|
||||
readonly plugins: {
|
||||
add: (
|
||||
plugin: (this: Artplayer, art: Artplayer) => any | Promise<any>,
|
||||
) => Promise<Artplayer['plugins']> | Artplayer['plugins']
|
||||
[pluginName: string]: any
|
||||
}
|
||||
}
|
||||
+99
-99
@@ -1,122 +1,122 @@
|
||||
import Artplayer = require('./artplayer');
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
export type Selector = {
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean;
|
||||
export interface Selector {
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean
|
||||
|
||||
/**
|
||||
* Html string of selector
|
||||
*/
|
||||
html: string | HTMLElement;
|
||||
};
|
||||
/**
|
||||
* Html string of selector
|
||||
*/
|
||||
html: string | HTMLElement
|
||||
}
|
||||
|
||||
export type Component = {
|
||||
/**
|
||||
* Component self-increasing id
|
||||
*/
|
||||
readonly id: number;
|
||||
export interface Component {
|
||||
/**
|
||||
* Component self-increasing id
|
||||
*/
|
||||
readonly id: number
|
||||
|
||||
/**
|
||||
* Component parent name
|
||||
*/
|
||||
readonly name: string | void;
|
||||
/**
|
||||
* Component parent name
|
||||
*/
|
||||
readonly name: string | void
|
||||
|
||||
/**
|
||||
* Component parent element
|
||||
*/
|
||||
readonly $parent: HTMLElement | void;
|
||||
/**
|
||||
* Component parent element
|
||||
*/
|
||||
readonly $parent: HTMLElement | void
|
||||
|
||||
/**
|
||||
* Whether to show component parent
|
||||
*/
|
||||
get show(): boolean;
|
||||
/**
|
||||
* Whether to show component parent
|
||||
*/
|
||||
get show(): boolean
|
||||
|
||||
/**
|
||||
* Whether to show component parent
|
||||
*/
|
||||
set show(state: boolean);
|
||||
/**
|
||||
* Whether to show component parent
|
||||
*/
|
||||
set show(state: boolean)
|
||||
|
||||
/**
|
||||
* Toggle the component parent
|
||||
*/
|
||||
toggle(): void;
|
||||
/**
|
||||
* Toggle the component parent
|
||||
*/
|
||||
toggle: () => void
|
||||
|
||||
/**
|
||||
* Dynamic add a component
|
||||
*/
|
||||
add(option: ComponentOption): HTMLElement;
|
||||
/**
|
||||
* Dynamic add a component
|
||||
*/
|
||||
add: (option: ComponentOption) => HTMLElement
|
||||
|
||||
/**
|
||||
* Dynamic remove a component by name
|
||||
*/
|
||||
remove(name: string): void;
|
||||
/**
|
||||
* Dynamic remove a component by name
|
||||
*/
|
||||
remove: (name: string) => void
|
||||
|
||||
/**
|
||||
* Dynamic update a component
|
||||
*/
|
||||
update(option: ComponentOption): HTMLElement;
|
||||
};
|
||||
/**
|
||||
* Dynamic update a component
|
||||
*/
|
||||
update: (option: ComponentOption) => HTMLElement
|
||||
}
|
||||
|
||||
export type ComponentOption = {
|
||||
/**
|
||||
* Html string or html element of component
|
||||
*/
|
||||
html?: string | HTMLElement;
|
||||
export interface ComponentOption {
|
||||
/**
|
||||
* Html string or html element of component
|
||||
*/
|
||||
html?: string | HTMLElement
|
||||
|
||||
/**
|
||||
* Whether to disable component
|
||||
*/
|
||||
disable?: boolean;
|
||||
/**
|
||||
* Whether to disable component
|
||||
*/
|
||||
disable?: boolean
|
||||
|
||||
/**
|
||||
* Unique name for component
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Unique name for component
|
||||
*/
|
||||
name?: string
|
||||
|
||||
/**
|
||||
* Component sort index
|
||||
*/
|
||||
index?: number;
|
||||
/**
|
||||
* Component sort index
|
||||
*/
|
||||
index?: number
|
||||
|
||||
/**
|
||||
* Component style object
|
||||
*/
|
||||
style?: Partial<CSSStyleDeclaration>;
|
||||
/**
|
||||
* Component style object
|
||||
*/
|
||||
style?: Partial<CSSStyleDeclaration>
|
||||
|
||||
/**
|
||||
* Component click event
|
||||
*/
|
||||
click?(this: Artplayer, component: Component, event: Event): void;
|
||||
/**
|
||||
* Component click event
|
||||
*/
|
||||
click?: (this: Artplayer, component: Component, event: Event) => void
|
||||
|
||||
/**
|
||||
* When the component was mounted
|
||||
*/
|
||||
mounted?(this: Artplayer, element: HTMLElement): void;
|
||||
/**
|
||||
* When the component was mounted
|
||||
*/
|
||||
mounted?: (this: Artplayer, element: HTMLElement) => void
|
||||
|
||||
/**
|
||||
* When the component was before unmount
|
||||
*/
|
||||
beforeUnmount?(this: Artplayer, element: HTMLElement): void;
|
||||
/**
|
||||
* When the component was before unmount
|
||||
*/
|
||||
beforeUnmount?: (this: Artplayer, element: HTMLElement) => void
|
||||
|
||||
/**
|
||||
* Component tooltip, use in controls
|
||||
*/
|
||||
tooltip?: string;
|
||||
/**
|
||||
* Component tooltip, use in controls
|
||||
*/
|
||||
tooltip?: string
|
||||
|
||||
/**
|
||||
* Component position, use in controls
|
||||
*/
|
||||
position?: 'top' | 'left' | 'right' | (string & Record<never, never>);
|
||||
/**
|
||||
* Component position, use in controls
|
||||
*/
|
||||
position?: 'top' | 'left' | 'right' | (string & Record<never, never>)
|
||||
|
||||
/**
|
||||
* Custom selector list, use in controls
|
||||
*/
|
||||
selector?: Selector[];
|
||||
/**
|
||||
* Custom selector list, use in controls
|
||||
*/
|
||||
selector?: Selector[]
|
||||
|
||||
/**
|
||||
* When selector item click, use in controls
|
||||
*/
|
||||
onSelect?(this: Artplayer, selector: Selector, element: HTMLElement, event: Event): void;
|
||||
};
|
||||
/**
|
||||
* When selector item click, use in controls
|
||||
*/
|
||||
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
|
||||
}
|
||||
Vendored
+84
-84
@@ -1,84 +1,84 @@
|
||||
export type Config = {
|
||||
/**
|
||||
* Supported video properties
|
||||
*/
|
||||
properties: [
|
||||
'audioTracks',
|
||||
'autoplay',
|
||||
'buffered',
|
||||
'controller',
|
||||
'controls',
|
||||
'crossOrigin',
|
||||
'currentSrc',
|
||||
'currentTime',
|
||||
'defaultMuted',
|
||||
'defaultPlaybackRate',
|
||||
'duration',
|
||||
'ended',
|
||||
'error',
|
||||
'loop',
|
||||
'mediaGroup',
|
||||
'muted',
|
||||
'networkState',
|
||||
'paused',
|
||||
'playbackRate',
|
||||
'played',
|
||||
'preload',
|
||||
'readyState',
|
||||
'seekable',
|
||||
'seeking',
|
||||
'src',
|
||||
'startDate',
|
||||
'textTracks',
|
||||
'videoTracks',
|
||||
'volume',
|
||||
];
|
||||
methods: ['addTextTrack', 'canPlayType', 'load', 'play', 'pause'];
|
||||
events: [
|
||||
'abort',
|
||||
'canplay',
|
||||
'canplaythrough',
|
||||
'durationchange',
|
||||
'emptied',
|
||||
'ended',
|
||||
'error',
|
||||
'loadeddata',
|
||||
'loadedmetadata',
|
||||
'loadstart',
|
||||
'pause',
|
||||
'play',
|
||||
'playing',
|
||||
'progress',
|
||||
'ratechange',
|
||||
'seeked',
|
||||
'seeking',
|
||||
'stalled',
|
||||
'suspend',
|
||||
'timeupdate',
|
||||
'volumechange',
|
||||
'waiting',
|
||||
];
|
||||
prototypes: [
|
||||
'width',
|
||||
'height',
|
||||
'videoWidth',
|
||||
'videoHeight',
|
||||
'poster',
|
||||
'webkitDecodedFrameCount',
|
||||
'webkitDroppedFrameCount',
|
||||
'playsInline',
|
||||
'webkitSupportsFullscreen',
|
||||
'webkitDisplayingFullscreen',
|
||||
'onenterpictureinpicture',
|
||||
'onleavepictureinpicture',
|
||||
'disablePictureInPicture',
|
||||
'cancelVideoFrameCallback',
|
||||
'requestVideoFrameCallback',
|
||||
'getVideoPlaybackQuality',
|
||||
'requestPictureInPicture',
|
||||
'webkitEnterFullScreen',
|
||||
'webkitEnterFullscreen',
|
||||
'webkitExitFullScreen',
|
||||
'webkitExitFullscreen',
|
||||
];
|
||||
};
|
||||
export interface Config {
|
||||
/**
|
||||
* Supported video properties
|
||||
*/
|
||||
properties: [
|
||||
'audioTracks',
|
||||
'autoplay',
|
||||
'buffered',
|
||||
'controller',
|
||||
'controls',
|
||||
'crossOrigin',
|
||||
'currentSrc',
|
||||
'currentTime',
|
||||
'defaultMuted',
|
||||
'defaultPlaybackRate',
|
||||
'duration',
|
||||
'ended',
|
||||
'error',
|
||||
'loop',
|
||||
'mediaGroup',
|
||||
'muted',
|
||||
'networkState',
|
||||
'paused',
|
||||
'playbackRate',
|
||||
'played',
|
||||
'preload',
|
||||
'readyState',
|
||||
'seekable',
|
||||
'seeking',
|
||||
'src',
|
||||
'startDate',
|
||||
'textTracks',
|
||||
'videoTracks',
|
||||
'volume',
|
||||
]
|
||||
methods: ['addTextTrack', 'canPlayType', 'load', 'play', 'pause']
|
||||
events: [
|
||||
'abort',
|
||||
'canplay',
|
||||
'canplaythrough',
|
||||
'durationchange',
|
||||
'emptied',
|
||||
'ended',
|
||||
'error',
|
||||
'loadeddata',
|
||||
'loadedmetadata',
|
||||
'loadstart',
|
||||
'pause',
|
||||
'play',
|
||||
'playing',
|
||||
'progress',
|
||||
'ratechange',
|
||||
'seeked',
|
||||
'seeking',
|
||||
'stalled',
|
||||
'suspend',
|
||||
'timeupdate',
|
||||
'volumechange',
|
||||
'waiting',
|
||||
]
|
||||
prototypes: [
|
||||
'width',
|
||||
'height',
|
||||
'videoWidth',
|
||||
'videoHeight',
|
||||
'poster',
|
||||
'webkitDecodedFrameCount',
|
||||
'webkitDroppedFrameCount',
|
||||
'playsInline',
|
||||
'webkitSupportsFullscreen',
|
||||
'webkitDisplayingFullscreen',
|
||||
'onenterpictureinpicture',
|
||||
'onleavepictureinpicture',
|
||||
'disablePictureInPicture',
|
||||
'cancelVideoFrameCallback',
|
||||
'requestVideoFrameCallback',
|
||||
'getVideoPlaybackQuality',
|
||||
'requestPictureInPicture',
|
||||
'webkitEnterFullScreen',
|
||||
'webkitEnterFullscreen',
|
||||
'webkitExitFullScreen',
|
||||
'webkitExitFullscreen',
|
||||
]
|
||||
}
|
||||
Vendored
+44
-44
@@ -1,44 +1,44 @@
|
||||
export type CssVar = {
|
||||
'--art-theme': string;
|
||||
'--art-font-color': string;
|
||||
'--art-background-color': string;
|
||||
'--art-text-shadow-color': string;
|
||||
'--art-transition-duration': string;
|
||||
'--art-padding': string;
|
||||
'--art-border-radius': string;
|
||||
'--art-progress-height': string;
|
||||
'--art-progress-color': string;
|
||||
'--art-hover-color': string;
|
||||
'--art-loaded-color': string;
|
||||
'--art-state-size': string;
|
||||
'--art-state-opacity': number;
|
||||
'--art-bottom-height': string;
|
||||
'--art-bottom-offset': string;
|
||||
'--art-bottom-gap': string;
|
||||
'--art-highlight-width': string;
|
||||
'--art-highlight-color': string;
|
||||
'--art-control-height': string;
|
||||
'--art-control-opacity': number;
|
||||
'--art-control-icon-size': string;
|
||||
'--art-control-icon-scale': number;
|
||||
'--art-volume-height': string;
|
||||
'--art-volume-handle-size': string;
|
||||
'--art-lock-size': string;
|
||||
'--art-indicator-scale': number;
|
||||
'--art-indicator-size': string;
|
||||
'--art-fullscreen-web-index': 9999;
|
||||
'--art-settings-icon-size': string;
|
||||
'--art-settings-max-height': string;
|
||||
'--art-selector-max-height': string;
|
||||
'--art-contextmenus-min-width': string;
|
||||
'--art-subtitle-font-size': string;
|
||||
'--art-subtitle-gap': string;
|
||||
'--art-subtitle-bottom': string;
|
||||
'--art-subtitle-border': string;
|
||||
'--art-widget-background': string;
|
||||
'--art-tip-background': string;
|
||||
'--art-scrollbar-size': string;
|
||||
'--art-scrollbar-background': string;
|
||||
'--art-scrollbar-background-hover': string;
|
||||
'--art-mini-progress-height': string;
|
||||
};
|
||||
export interface CssVar {
|
||||
'--art-theme': string
|
||||
'--art-font-color': string
|
||||
'--art-background-color': string
|
||||
'--art-text-shadow-color': string
|
||||
'--art-transition-duration': string
|
||||
'--art-padding': string
|
||||
'--art-border-radius': string
|
||||
'--art-progress-height': string
|
||||
'--art-progress-color': string
|
||||
'--art-hover-color': string
|
||||
'--art-loaded-color': string
|
||||
'--art-state-size': string
|
||||
'--art-state-opacity': number
|
||||
'--art-bottom-height': string
|
||||
'--art-bottom-offset': string
|
||||
'--art-bottom-gap': string
|
||||
'--art-highlight-width': string
|
||||
'--art-highlight-color': string
|
||||
'--art-control-height': string
|
||||
'--art-control-opacity': number
|
||||
'--art-control-icon-size': string
|
||||
'--art-control-icon-scale': number
|
||||
'--art-volume-height': string
|
||||
'--art-volume-handle-size': string
|
||||
'--art-lock-size': string
|
||||
'--art-indicator-scale': number
|
||||
'--art-indicator-size': string
|
||||
'--art-fullscreen-web-index': 9999
|
||||
'--art-settings-icon-size': string
|
||||
'--art-settings-max-height': string
|
||||
'--art-selector-max-height': string
|
||||
'--art-contextmenus-min-width': string
|
||||
'--art-subtitle-font-size': string
|
||||
'--art-subtitle-gap': string
|
||||
'--art-subtitle-bottom': string
|
||||
'--art-subtitle-border': string
|
||||
'--art-widget-background': string
|
||||
'--art-tip-background': string
|
||||
'--art-scrollbar-size': string
|
||||
'--art-scrollbar-background': string
|
||||
'--art-scrollbar-background-hover': string
|
||||
'--art-mini-progress-height': string
|
||||
}
|
||||
Vendored
+70
-70
@@ -1,72 +1,72 @@
|
||||
import { AspectRatio, Flip } from './player';
|
||||
import { Subtitle } from './subtitle';
|
||||
import type { AspectRatio, Flip } from './player'
|
||||
import type { Subtitle } from './subtitle'
|
||||
|
||||
export type Bar = 'loaded' | 'played' | 'hover';
|
||||
export type Bar = 'loaded' | 'played' | 'hover'
|
||||
|
||||
export type Events = {
|
||||
'video:canplay': [event: Event];
|
||||
'video:canplaythrough': [event: Event];
|
||||
'video:complete': [event: Event];
|
||||
'video:durationchange': [event: Event];
|
||||
'video:emptied': [event: Event];
|
||||
'video:ended': [event: Event];
|
||||
'video:error': [event: Error];
|
||||
'video:loadeddata': [event: Event];
|
||||
'video:loadedmetadata': [event: Event];
|
||||
'video:pause': [event: Event];
|
||||
'video:play': [event: Event];
|
||||
'video:playing': [event: Event];
|
||||
'video:progress': [event: Event];
|
||||
'video:ratechange': [event: Event];
|
||||
'video:seeked': [event: Event];
|
||||
'video:seeking': [event: Event];
|
||||
'video:stalled': [event: Event];
|
||||
'video:suspend': [event: Event];
|
||||
'video:timeupdate': [event: Event];
|
||||
'video:volumechange': [event: Event];
|
||||
'video:waiting': [event: Event];
|
||||
'document:mousemove': [event: Event];
|
||||
'document:mouseup': [event: Event];
|
||||
info: [state: boolean];
|
||||
layer: [state: boolean];
|
||||
loading: [state: boolean];
|
||||
mask: [state: boolean];
|
||||
subtitle: [state: boolean];
|
||||
contextmenu: [state: boolean];
|
||||
control: [state: boolean];
|
||||
setting: [state: boolean];
|
||||
hotkey: [event: Event];
|
||||
destroy: [];
|
||||
subtitleOffset: [offset: number];
|
||||
subtitleBeforeUpdate: [cue: VTTCue];
|
||||
subtitleAfterUpdate: [cue: VTTCue];
|
||||
subtitleLoad: [cues: VTTCue[], option: Subtitle];
|
||||
focus: [event: Event];
|
||||
blur: [event: Event];
|
||||
dblclick: [event: Event];
|
||||
click: [event: Event];
|
||||
hover: [state: boolean, event: Event];
|
||||
mousemove: [event: Event];
|
||||
resize: [];
|
||||
view: [state: boolean];
|
||||
lock: [state: boolean];
|
||||
aspectRatio: [aspectRatio: AspectRatio];
|
||||
autoHeight: [height: number];
|
||||
autoSize: [];
|
||||
ready: [];
|
||||
error: [error: Error, reconnectTime: number];
|
||||
flip: [flip: Flip];
|
||||
fullscreen: [state: boolean];
|
||||
fullscreenError: [event: Event];
|
||||
fullscreenWeb: [state: boolean];
|
||||
mini: [state: boolean];
|
||||
pause: [];
|
||||
pip: [state: boolean];
|
||||
play: [];
|
||||
screenshot: [dataUri: string];
|
||||
seek: [currentTime: number];
|
||||
restart: [url: string];
|
||||
muted: [state: boolean];
|
||||
setBar: [type: Bar, percentage: number, event?: Event];
|
||||
keydown: [event: KeyboardEvent];
|
||||
};
|
||||
export interface Events {
|
||||
'video:canplay': [event: Event]
|
||||
'video:canplaythrough': [event: Event]
|
||||
'video:complete': [event: Event]
|
||||
'video:durationchange': [event: Event]
|
||||
'video:emptied': [event: Event]
|
||||
'video:ended': [event: Event]
|
||||
'video:error': [event: Error]
|
||||
'video:loadeddata': [event: Event]
|
||||
'video:loadedmetadata': [event: Event]
|
||||
'video:pause': [event: Event]
|
||||
'video:play': [event: Event]
|
||||
'video:playing': [event: Event]
|
||||
'video:progress': [event: Event]
|
||||
'video:ratechange': [event: Event]
|
||||
'video:seeked': [event: Event]
|
||||
'video:seeking': [event: Event]
|
||||
'video:stalled': [event: Event]
|
||||
'video:suspend': [event: Event]
|
||||
'video:timeupdate': [event: Event]
|
||||
'video:volumechange': [event: Event]
|
||||
'video:waiting': [event: Event]
|
||||
'document:mousemove': [event: Event]
|
||||
'document:mouseup': [event: Event]
|
||||
'info': [state: boolean]
|
||||
'layer': [state: boolean]
|
||||
'loading': [state: boolean]
|
||||
'mask': [state: boolean]
|
||||
'subtitle': [state: boolean]
|
||||
'contextmenu': [state: boolean]
|
||||
'control': [state: boolean]
|
||||
'setting': [state: boolean]
|
||||
'hotkey': [event: Event]
|
||||
'destroy': []
|
||||
'subtitleOffset': [offset: number]
|
||||
'subtitleBeforeUpdate': [cue: VTTCue]
|
||||
'subtitleAfterUpdate': [cue: VTTCue]
|
||||
'subtitleLoad': [cues: VTTCue[], option: Subtitle]
|
||||
'focus': [event: Event]
|
||||
'blur': [event: Event]
|
||||
'dblclick': [event: Event]
|
||||
'click': [event: Event]
|
||||
'hover': [state: boolean, event: Event]
|
||||
'mousemove': [event: Event]
|
||||
'resize': []
|
||||
'view': [state: boolean]
|
||||
'lock': [state: boolean]
|
||||
'aspectRatio': [aspectRatio: AspectRatio]
|
||||
'autoHeight': [height: number]
|
||||
'autoSize': []
|
||||
'ready': []
|
||||
'error': [error: Error, reconnectTime: number]
|
||||
'flip': [flip: Flip]
|
||||
'fullscreen': [state: boolean]
|
||||
'fullscreenError': [event: Event]
|
||||
'fullscreenWeb': [state: boolean]
|
||||
'mini': [state: boolean]
|
||||
'pause': []
|
||||
'pip': [state: boolean]
|
||||
'play': []
|
||||
'screenshot': [dataUri: string]
|
||||
'seek': [currentTime: number]
|
||||
'restart': [url: string]
|
||||
'muted': [state: boolean]
|
||||
'setBar': [type: Bar, percentage: number, event?: Event]
|
||||
'keydown': [event: KeyboardEvent]
|
||||
}
|
||||
Vendored
+54
-54
@@ -1,56 +1,56 @@
|
||||
type I18nKeys =
|
||||
| 'en'
|
||||
| 'zh-cn'
|
||||
| 'zh-tw'
|
||||
| 'pl'
|
||||
| 'cs'
|
||||
| 'es'
|
||||
| 'fa'
|
||||
| 'fr'
|
||||
| 'id'
|
||||
| 'ru'
|
||||
| 'tr'
|
||||
| 'ar'
|
||||
| 'vi'
|
||||
| (string & Record<never, never>);
|
||||
type I18nKeys
|
||||
= | 'en'
|
||||
| 'zh-cn'
|
||||
| 'zh-tw'
|
||||
| 'pl'
|
||||
| 'cs'
|
||||
| 'es'
|
||||
| 'fa'
|
||||
| 'fr'
|
||||
| 'id'
|
||||
| 'ru'
|
||||
| 'tr'
|
||||
| 'ar'
|
||||
| 'vi'
|
||||
| (string & Record<never, never>)
|
||||
|
||||
type I18nValue = {
|
||||
'Video Info': string;
|
||||
Close: string;
|
||||
'Video Load Failed': string;
|
||||
Volume: string;
|
||||
Play: string;
|
||||
Pause: string;
|
||||
Rate: string;
|
||||
Mute: string;
|
||||
'Video Flip': string;
|
||||
Horizontal: string;
|
||||
Vertical: string;
|
||||
Reconnect: string;
|
||||
'Show Setting': string;
|
||||
'Hide Setting': string;
|
||||
Screenshot: string;
|
||||
'Play Speed': string;
|
||||
'Aspect Ratio': string;
|
||||
Default: string;
|
||||
Normal: string;
|
||||
Open: string;
|
||||
'Switch Video': string;
|
||||
'Switch Subtitle': string;
|
||||
Fullscreen: string;
|
||||
'Exit Fullscreen': string;
|
||||
'Web Fullscreen': string;
|
||||
'Exit Web Fullscreen': string;
|
||||
'Mini Player': string;
|
||||
'PIP Mode': string;
|
||||
'Exit PIP Mode': string;
|
||||
'PIP Not Supported': string;
|
||||
'Fullscreen Not Supported': string;
|
||||
'Subtitle Offset': string;
|
||||
'Last Seen': string;
|
||||
'Jump Play': string;
|
||||
AirPlay: string;
|
||||
'AirPlay Not Available': string;
|
||||
};
|
||||
interface I18nValue {
|
||||
'Video Info': string
|
||||
'Close': string
|
||||
'Video Load Failed': string
|
||||
'Volume': string
|
||||
'Play': string
|
||||
'Pause': string
|
||||
'Rate': string
|
||||
'Mute': string
|
||||
'Video Flip': string
|
||||
'Horizontal': string
|
||||
'Vertical': string
|
||||
'Reconnect': string
|
||||
'Show Setting': string
|
||||
'Hide Setting': string
|
||||
'Screenshot': string
|
||||
'Play Speed': string
|
||||
'Aspect Ratio': string
|
||||
'Default': string
|
||||
'Normal': string
|
||||
'Open': string
|
||||
'Switch Video': string
|
||||
'Switch Subtitle': string
|
||||
'Fullscreen': string
|
||||
'Exit Fullscreen': string
|
||||
'Web Fullscreen': string
|
||||
'Exit Web Fullscreen': string
|
||||
'Mini Player': string
|
||||
'PIP Mode': string
|
||||
'Exit PIP Mode': string
|
||||
'PIP Not Supported': string
|
||||
'Fullscreen Not Supported': string
|
||||
'Subtitle Offset': string
|
||||
'Last Seen': string
|
||||
'Jump Play': string
|
||||
'AirPlay': string
|
||||
'AirPlay Not Available': string
|
||||
}
|
||||
|
||||
export type I18n = Partial<Record<I18nKeys, Partial<I18nValue>>>;
|
||||
export type I18n = Partial<Record<I18nKeys, Partial<I18nValue>>>
|
||||
Vendored
+30
-30
@@ -1,30 +1,30 @@
|
||||
export type Icons = {
|
||||
readonly loading: HTMLDivElement;
|
||||
readonly state: HTMLDivElement;
|
||||
readonly play: HTMLDivElement;
|
||||
readonly pause: HTMLDivElement;
|
||||
readonly check: HTMLDivElement;
|
||||
readonly volume: HTMLDivElement;
|
||||
readonly volumeClose: HTMLDivElement;
|
||||
readonly screenshot: HTMLDivElement;
|
||||
readonly setting: HTMLDivElement;
|
||||
readonly pip: HTMLDivElement;
|
||||
readonly arrowLeft: HTMLDivElement;
|
||||
readonly arrowRight: HTMLDivElement;
|
||||
readonly playbackRate: HTMLDivElement;
|
||||
readonly aspectRatio: HTMLDivElement;
|
||||
readonly config: HTMLDivElement;
|
||||
readonly lock: HTMLDivElement;
|
||||
readonly flip: HTMLDivElement;
|
||||
readonly unlock: HTMLDivElement;
|
||||
readonly fullscreenOff: HTMLDivElement;
|
||||
readonly fullscreenOn: HTMLDivElement;
|
||||
readonly fullscreenWebOff: HTMLDivElement;
|
||||
readonly fullscreenWebOn: HTMLDivElement;
|
||||
readonly switchOn: HTMLDivElement;
|
||||
readonly switchOff: HTMLDivElement;
|
||||
readonly error: HTMLDivElement;
|
||||
readonly close: HTMLDivElement;
|
||||
readonly airplay: HTMLDivElement;
|
||||
readonly [key: string]: HTMLDivElement;
|
||||
};
|
||||
export interface Icons {
|
||||
readonly loading: HTMLDivElement
|
||||
readonly state: HTMLDivElement
|
||||
readonly play: HTMLDivElement
|
||||
readonly pause: HTMLDivElement
|
||||
readonly check: HTMLDivElement
|
||||
readonly volume: HTMLDivElement
|
||||
readonly volumeClose: HTMLDivElement
|
||||
readonly screenshot: HTMLDivElement
|
||||
readonly setting: HTMLDivElement
|
||||
readonly pip: HTMLDivElement
|
||||
readonly arrowLeft: HTMLDivElement
|
||||
readonly arrowRight: HTMLDivElement
|
||||
readonly playbackRate: HTMLDivElement
|
||||
readonly aspectRatio: HTMLDivElement
|
||||
readonly config: HTMLDivElement
|
||||
readonly lock: HTMLDivElement
|
||||
readonly flip: HTMLDivElement
|
||||
readonly unlock: HTMLDivElement
|
||||
readonly fullscreenOff: HTMLDivElement
|
||||
readonly fullscreenOn: HTMLDivElement
|
||||
readonly fullscreenWebOff: HTMLDivElement
|
||||
readonly fullscreenWebOn: HTMLDivElement
|
||||
readonly switchOn: HTMLDivElement
|
||||
readonly switchOff: HTMLDivElement
|
||||
readonly error: HTMLDivElement
|
||||
readonly close: HTMLDivElement
|
||||
readonly airplay: HTMLDivElement
|
||||
readonly [key: string]: HTMLDivElement
|
||||
}
|
||||
Vendored
+296
-296
@@ -1,312 +1,312 @@
|
||||
import { Subtitle } from './subtitle';
|
||||
import { Setting } from './setting';
|
||||
import { Icons } from './icons';
|
||||
import { I18n } from './i18n';
|
||||
import { CssVar } from './cssVar';
|
||||
import { Quality } from './quality';
|
||||
import { ComponentOption } from './component';
|
||||
import Artplayer = require('./artplayer');
|
||||
import type { ComponentOption } from './component'
|
||||
import type { CssVar } from './cssVar'
|
||||
import type { I18n } from './i18n'
|
||||
import type { Icons } from './icons'
|
||||
import type { Quality } from './quality'
|
||||
import type { Setting } from './setting'
|
||||
import type { Subtitle } from './subtitle'
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
export type CustomType = 'flv' | 'm3u8' | 'hls' | 'ts' | 'mpd' | 'torrent' | (string & Record<never, never>);
|
||||
export type CustomType = 'flv' | 'm3u8' | 'hls' | 'ts' | 'mpd' | 'torrent' | (string & Record<never, never>)
|
||||
|
||||
export type Thumbnails = {
|
||||
export interface 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 interface Option {
|
||||
/**
|
||||
* The player id
|
||||
*/
|
||||
id?: string
|
||||
|
||||
/**
|
||||
* The container mounted by the player
|
||||
*/
|
||||
container: string | HTMLDivElement
|
||||
|
||||
/**
|
||||
* Video url
|
||||
*/
|
||||
url: string
|
||||
|
||||
/**
|
||||
* Video poster image url
|
||||
*/
|
||||
poster?: string
|
||||
|
||||
/**
|
||||
* Video url type
|
||||
*/
|
||||
type?: CustomType
|
||||
|
||||
/**
|
||||
* Player color theme
|
||||
*/
|
||||
theme?: string
|
||||
|
||||
/**
|
||||
* Player language
|
||||
*/
|
||||
lang?: keyof I18n
|
||||
|
||||
/**
|
||||
* Player default volume
|
||||
*/
|
||||
volume?: number
|
||||
|
||||
/**
|
||||
* Whether live broadcast mode
|
||||
*/
|
||||
isLive?: boolean
|
||||
|
||||
/**
|
||||
* Whether video muted
|
||||
*/
|
||||
muted?: boolean
|
||||
|
||||
/**
|
||||
* Whether video auto play
|
||||
*/
|
||||
autoplay?: boolean
|
||||
|
||||
/**
|
||||
* Whether player auto resize
|
||||
*/
|
||||
autoSize?: boolean
|
||||
|
||||
/**
|
||||
* Whether player auto run mini mode
|
||||
*/
|
||||
autoMini?: boolean
|
||||
|
||||
/**
|
||||
* Whether video auto loop
|
||||
*/
|
||||
loop?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video flip button
|
||||
*/
|
||||
flip?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video playback rate button
|
||||
*/
|
||||
playbackRate?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video aspect ratio button
|
||||
*/
|
||||
aspectRatio?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video screenshot button
|
||||
*/
|
||||
screenshot?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video setting button
|
||||
*/
|
||||
setting?: boolean
|
||||
|
||||
/**
|
||||
* Whether to enable player hotkey
|
||||
*/
|
||||
hotkey?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video pip button
|
||||
*/
|
||||
pip?: boolean
|
||||
|
||||
/**
|
||||
* Do you want to run only one player at a time
|
||||
*/
|
||||
mutex?: boolean
|
||||
|
||||
/**
|
||||
* Whether use backdrop in UI
|
||||
*/
|
||||
backdrop?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video window fullscreen button
|
||||
*/
|
||||
fullscreen?: boolean
|
||||
|
||||
/**
|
||||
* Whether show video web fullscreen button
|
||||
*/
|
||||
fullscreenWeb?: boolean
|
||||
|
||||
/**
|
||||
* Whether to enable player subtitle offset
|
||||
*/
|
||||
subtitleOffset?: boolean
|
||||
|
||||
/**
|
||||
* Whether to enable player mini progress bar
|
||||
*/
|
||||
miniProgressBar?: boolean
|
||||
|
||||
/**
|
||||
* Whether use SSR function
|
||||
*/
|
||||
useSSR?: boolean
|
||||
|
||||
/**
|
||||
* Whether use playsInline in mobile
|
||||
*/
|
||||
playsInline?: boolean
|
||||
|
||||
/**
|
||||
* Whether use lock in mobile
|
||||
*/
|
||||
lock?: boolean
|
||||
|
||||
/**
|
||||
* Whether use gesture in mobile
|
||||
*/
|
||||
gesture?: boolean
|
||||
|
||||
/**
|
||||
* Whether use fast forward in mobile
|
||||
*/
|
||||
fastForward?: boolean
|
||||
|
||||
/**
|
||||
* Whether use auto playback
|
||||
*/
|
||||
autoPlayback?: boolean
|
||||
|
||||
/**
|
||||
* Whether use auto orientation in mobile
|
||||
*/
|
||||
autoOrientation?: boolean
|
||||
|
||||
/**
|
||||
* Whether use airplay
|
||||
*/
|
||||
airplay?: boolean
|
||||
|
||||
/**
|
||||
* Custom video proxy
|
||||
*/
|
||||
proxy?: (this: Artplayer, art: Artplayer) => HTMLCanvasElement | HTMLVideoElement
|
||||
|
||||
/**
|
||||
* Custom plugin list
|
||||
*/
|
||||
plugins?: ((this: Artplayer, art: Artplayer) => unknown)[]
|
||||
|
||||
/**
|
||||
* Custom layer list
|
||||
*/
|
||||
layers?: ComponentOption[]
|
||||
|
||||
/**
|
||||
* Custom contextmenu list
|
||||
*/
|
||||
contextmenu?: ComponentOption[]
|
||||
|
||||
/**
|
||||
* Custom control list
|
||||
*/
|
||||
controls?: ComponentOption[]
|
||||
|
||||
/**
|
||||
* Custom setting list
|
||||
*/
|
||||
settings?: Setting[]
|
||||
|
||||
/**
|
||||
* Custom video quality list
|
||||
*/
|
||||
quality?: Quality[]
|
||||
|
||||
/**
|
||||
* Custom highlight list
|
||||
*/
|
||||
highlight?: {
|
||||
/**
|
||||
* The thumbnail image url
|
||||
* The highlight time
|
||||
*/
|
||||
url: string;
|
||||
time: number
|
||||
|
||||
/**
|
||||
* The thumbnail item number
|
||||
* The highlight text
|
||||
*/
|
||||
number?: number;
|
||||
text: string
|
||||
}[]
|
||||
|
||||
/**
|
||||
* The thumbnail column size
|
||||
*/
|
||||
column?: number;
|
||||
/**
|
||||
* Custom thumbnail
|
||||
*/
|
||||
thumbnails?: Thumbnails
|
||||
|
||||
/**
|
||||
* The thumbnail width
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* Custom subtitle option
|
||||
*/
|
||||
subtitle?: Subtitle
|
||||
|
||||
/**
|
||||
* The thumbnail height
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* Other video attribute
|
||||
*/
|
||||
moreVideoAttr?: Partial<{
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends Function ? never : key]: HTMLVideoElement[key];
|
||||
}>
|
||||
|
||||
/**
|
||||
* The thumbnail scale
|
||||
*/
|
||||
scale?: number;
|
||||
};
|
||||
/**
|
||||
* Custom i18n
|
||||
*/
|
||||
i18n?: I18n
|
||||
|
||||
export type Option = {
|
||||
/**
|
||||
* The player id
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* Custom default icons
|
||||
*/
|
||||
icons?: {
|
||||
[key in keyof Icons]?: HTMLElement | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The container mounted by the player
|
||||
*/
|
||||
container: string | HTMLDivElement;
|
||||
/**
|
||||
* Custom css variables
|
||||
*/
|
||||
cssVar?: Partial<CssVar>
|
||||
|
||||
/**
|
||||
* Video url
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Video poster image url
|
||||
*/
|
||||
poster?: string;
|
||||
|
||||
/**
|
||||
* Video url type
|
||||
*/
|
||||
type?: CustomType;
|
||||
|
||||
/**
|
||||
* Player color theme
|
||||
*/
|
||||
theme?: string;
|
||||
|
||||
/**
|
||||
* Player language
|
||||
*/
|
||||
lang?: keyof I18n;
|
||||
|
||||
/**
|
||||
* Player default volume
|
||||
*/
|
||||
volume?: number;
|
||||
|
||||
/**
|
||||
* Whether live broadcast mode
|
||||
*/
|
||||
isLive?: boolean;
|
||||
|
||||
/**
|
||||
* Whether video muted
|
||||
*/
|
||||
muted?: boolean;
|
||||
|
||||
/**
|
||||
* Whether video auto play
|
||||
*/
|
||||
autoplay?: boolean;
|
||||
|
||||
/**
|
||||
* Whether player auto resize
|
||||
*/
|
||||
autoSize?: boolean;
|
||||
|
||||
/**
|
||||
* Whether player auto run mini mode
|
||||
*/
|
||||
autoMini?: boolean;
|
||||
|
||||
/**
|
||||
* Whether video auto loop
|
||||
*/
|
||||
loop?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video flip button
|
||||
*/
|
||||
flip?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video playback rate button
|
||||
*/
|
||||
playbackRate?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video aspect ratio button
|
||||
*/
|
||||
aspectRatio?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video screenshot button
|
||||
*/
|
||||
screenshot?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video setting button
|
||||
*/
|
||||
setting?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enable player hotkey
|
||||
*/
|
||||
hotkey?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video pip button
|
||||
*/
|
||||
pip?: boolean;
|
||||
|
||||
/**
|
||||
* Do you want to run only one player at a time
|
||||
*/
|
||||
mutex?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use backdrop in UI
|
||||
*/
|
||||
backdrop?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video window fullscreen button
|
||||
*/
|
||||
fullscreen?: boolean;
|
||||
|
||||
/**
|
||||
* Whether show video web fullscreen button
|
||||
*/
|
||||
fullscreenWeb?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enable player subtitle offset
|
||||
*/
|
||||
subtitleOffset?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enable player mini progress bar
|
||||
*/
|
||||
miniProgressBar?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use SSR function
|
||||
*/
|
||||
useSSR?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use playsInline in mobile
|
||||
*/
|
||||
playsInline?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use lock in mobile
|
||||
*/
|
||||
lock?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use gesture in mobile
|
||||
*/
|
||||
gesture?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use fast forward in mobile
|
||||
*/
|
||||
fastForward?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use auto playback
|
||||
*/
|
||||
autoPlayback?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use auto orientation in mobile
|
||||
*/
|
||||
autoOrientation?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use airplay
|
||||
*/
|
||||
airplay?: boolean;
|
||||
|
||||
/**
|
||||
* Custom video proxy
|
||||
*/
|
||||
proxy?: (this: Artplayer, art: Artplayer) => HTMLCanvasElement | HTMLVideoElement;
|
||||
|
||||
/**
|
||||
* Custom plugin list
|
||||
*/
|
||||
plugins?: ((this: Artplayer, art: Artplayer) => unknown)[];
|
||||
|
||||
/**
|
||||
* Custom layer list
|
||||
*/
|
||||
layers?: ComponentOption[];
|
||||
|
||||
/**
|
||||
* Custom contextmenu list
|
||||
*/
|
||||
contextmenu?: ComponentOption[];
|
||||
|
||||
/**
|
||||
* Custom control list
|
||||
*/
|
||||
controls?: ComponentOption[];
|
||||
|
||||
/**
|
||||
* Custom setting list
|
||||
*/
|
||||
settings?: Setting[];
|
||||
|
||||
/**
|
||||
* Custom video quality list
|
||||
*/
|
||||
quality?: Quality[];
|
||||
|
||||
/**
|
||||
* Custom highlight list
|
||||
*/
|
||||
highlight?: {
|
||||
/**
|
||||
* The highlight time
|
||||
*/
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* The highlight text
|
||||
*/
|
||||
text: string;
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Custom thumbnail
|
||||
*/
|
||||
thumbnails?: Thumbnails;
|
||||
|
||||
/**
|
||||
* Custom subtitle option
|
||||
*/
|
||||
subtitle?: Subtitle;
|
||||
|
||||
/**
|
||||
* Other video attribute
|
||||
*/
|
||||
moreVideoAttr?: Partial<{
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends Function ? never : key]: HTMLVideoElement[key];
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Custom i18n
|
||||
*/
|
||||
i18n?: I18n;
|
||||
|
||||
/**
|
||||
* Custom default icons
|
||||
*/
|
||||
icons?: {
|
||||
[key in keyof Icons]?: HTMLElement | string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom css variables
|
||||
*/
|
||||
cssVar?: Partial<CssVar>;
|
||||
|
||||
/**
|
||||
* Custom video type function
|
||||
*/
|
||||
customType?: Partial<
|
||||
/**
|
||||
* Custom video type function
|
||||
*/
|
||||
customType?: Partial<
|
||||
Record<CustomType, (this: Artplayer, video: HTMLVideoElement, url: string, art: Artplayer) => any>
|
||||
>;
|
||||
};
|
||||
>
|
||||
}
|
||||
|
||||
export default Option;
|
||||
export default Option
|
||||
Vendored
+77
-77
@@ -1,81 +1,81 @@
|
||||
import { CssVar } from './cssVar';
|
||||
import { CustomType, Thumbnails } from './option';
|
||||
import { Quality } from './quality';
|
||||
import type { CssVar } from './cssVar'
|
||||
import type { CustomType, Thumbnails } from './option'
|
||||
import type { Quality } from './quality'
|
||||
|
||||
export type AspectRatio = 'default' | '4:3' | '16:9' | (`${number}:${number}` & Record<never, never>);
|
||||
export type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | (number & Record<never, never>);
|
||||
export type Flip = 'normal' | 'horizontal' | 'vertical' | (string & Record<never, never>);
|
||||
export type State = 'standard' | 'mini' | 'pip' | 'fullscreen' | 'fullscreenWeb';
|
||||
export type AspectRatio = 'default' | '4:3' | '16:9' | (`${number}:${number}` & Record<never, never>)
|
||||
export type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | (number & Record<never, never>)
|
||||
export type Flip = 'normal' | 'horizontal' | 'vertical' | (string & Record<never, never>)
|
||||
export type State = 'standard' | 'mini' | 'pip' | 'fullscreen' | 'fullscreenWeb'
|
||||
|
||||
export declare class Player {
|
||||
get aspectRatio(): AspectRatio;
|
||||
set aspectRatio(ratio: AspectRatio);
|
||||
get state(): State;
|
||||
set state(state: State);
|
||||
get type(): CustomType;
|
||||
set type(name: CustomType);
|
||||
get playbackRate(): PlaybackRate;
|
||||
set playbackRate(rate: PlaybackRate);
|
||||
get currentTime(): number;
|
||||
set currentTime(time: number);
|
||||
get duration(): number;
|
||||
get played(): number;
|
||||
get playing(): boolean;
|
||||
get flip(): Flip;
|
||||
set flip(state: Flip);
|
||||
get fullscreen(): boolean;
|
||||
set fullscreen(state: boolean);
|
||||
set fullscreenToggle(state: boolean);
|
||||
get fullscreenWeb(): boolean;
|
||||
set fullscreenWeb(state: boolean);
|
||||
set fullscreenWebToggle(state: boolean);
|
||||
get loaded(): number;
|
||||
get loadedTime(): number;
|
||||
get mini(): boolean;
|
||||
set mini(state: boolean);
|
||||
get pip(): boolean;
|
||||
set pip(state: boolean);
|
||||
get poster(): string;
|
||||
set poster(url: string);
|
||||
get rect(): DOMRect;
|
||||
get bottom(): number;
|
||||
get height(): number;
|
||||
get left(): number;
|
||||
get right(): number;
|
||||
get top(): number;
|
||||
get width(): number;
|
||||
get x(): number;
|
||||
get y(): number;
|
||||
set seek(time: number);
|
||||
set forward(time: number);
|
||||
set backward(time: number);
|
||||
get url(): string;
|
||||
set url(url: string);
|
||||
get volume(): number;
|
||||
set volume(percentage: number);
|
||||
get muted(): boolean;
|
||||
set muted(state: boolean);
|
||||
get title(): string;
|
||||
set title(title: string);
|
||||
get theme(): string;
|
||||
set theme(theme: string);
|
||||
get subtitleOffset(): number;
|
||||
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;
|
||||
attr(key: string, value?: any): unknown;
|
||||
cssVar<T extends keyof CssVar>(key: T, value?: CssVar[T]): CssVar[T];
|
||||
switchUrl(url: string): Promise<void>;
|
||||
switchQuality(url: string): Promise<void>;
|
||||
getDataURL(): Promise<string>;
|
||||
getBlobUrl(): Promise<string>;
|
||||
screenshot(name?: string): Promise<string>;
|
||||
airplay(): void;
|
||||
autoSize(): void;
|
||||
autoHeight(): void;
|
||||
get aspectRatio(): AspectRatio
|
||||
set aspectRatio(ratio: AspectRatio)
|
||||
get state(): State
|
||||
set state(state: State)
|
||||
get type(): CustomType
|
||||
set type(name: CustomType)
|
||||
get playbackRate(): PlaybackRate
|
||||
set playbackRate(rate: PlaybackRate)
|
||||
get currentTime(): number
|
||||
set currentTime(time: number)
|
||||
get duration(): number
|
||||
get played(): number
|
||||
get playing(): boolean
|
||||
get flip(): Flip
|
||||
set flip(state: Flip)
|
||||
get fullscreen(): boolean
|
||||
set fullscreen(state: boolean)
|
||||
set fullscreenToggle(state: boolean)
|
||||
get fullscreenWeb(): boolean
|
||||
set fullscreenWeb(state: boolean)
|
||||
set fullscreenWebToggle(state: boolean)
|
||||
get loaded(): number
|
||||
get loadedTime(): number
|
||||
get mini(): boolean
|
||||
set mini(state: boolean)
|
||||
get pip(): boolean
|
||||
set pip(state: boolean)
|
||||
get poster(): string
|
||||
set poster(url: string)
|
||||
get rect(): DOMRect
|
||||
get bottom(): number
|
||||
get height(): number
|
||||
get left(): number
|
||||
get right(): number
|
||||
get top(): number
|
||||
get width(): number
|
||||
get x(): number
|
||||
get y(): number
|
||||
set seek(time: number)
|
||||
set forward(time: number)
|
||||
set backward(time: number)
|
||||
get url(): string
|
||||
set url(url: string)
|
||||
get volume(): number
|
||||
set volume(percentage: number)
|
||||
get muted(): boolean
|
||||
set muted(state: boolean)
|
||||
get title(): string
|
||||
set title(title: string)
|
||||
get theme(): string
|
||||
set theme(theme: string)
|
||||
get subtitleOffset(): number
|
||||
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
|
||||
attr(key: string, value?: any): unknown
|
||||
cssVar<T extends keyof CssVar>(key: T, value?: CssVar[T]): CssVar[T]
|
||||
switchUrl(url: string): Promise<void>
|
||||
switchQuality(url: string): Promise<void>
|
||||
getDataURL(): Promise<string>
|
||||
getBlobUrl(): Promise<string>
|
||||
screenshot(name?: string): Promise<string>
|
||||
airplay(): void
|
||||
autoSize(): void
|
||||
autoHeight(): void
|
||||
}
|
||||
+14
-14
@@ -1,16 +1,16 @@
|
||||
export type Quality = {
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean;
|
||||
export interface Quality {
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean
|
||||
|
||||
/**
|
||||
* Html string of quality
|
||||
*/
|
||||
html: string | HTMLElement;
|
||||
/**
|
||||
* Html string of quality
|
||||
*/
|
||||
html: string | HTMLElement
|
||||
|
||||
/**
|
||||
* Video quality url
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
/**
|
||||
* Video quality url
|
||||
*/
|
||||
url: string
|
||||
}
|
||||
+76
-76
@@ -1,94 +1,94 @@
|
||||
import Artplayer = require('./artplayer');
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
type Props<T> = {
|
||||
html: string;
|
||||
icon: string;
|
||||
tooltip: string;
|
||||
$item: HTMLDivElement;
|
||||
$icon: HTMLDivElement;
|
||||
$html: HTMLDivElement;
|
||||
$tooltip: HTMLDivElement;
|
||||
$switch: HTMLDivElement;
|
||||
$range: HTMLInputElement;
|
||||
$parent: Setting;
|
||||
$parents: Setting[];
|
||||
$option: Setting[];
|
||||
$events: Function[];
|
||||
$formatted: boolean;
|
||||
} & Omit<T, 'html' | 'icon' | 'tooltip'>;
|
||||
html: string
|
||||
icon: string
|
||||
tooltip: string
|
||||
$item: HTMLDivElement
|
||||
$icon: HTMLDivElement
|
||||
$html: HTMLDivElement
|
||||
$tooltip: HTMLDivElement
|
||||
$switch: HTMLDivElement
|
||||
$range: HTMLInputElement
|
||||
$parent: Setting
|
||||
$parents: Setting[]
|
||||
$option: Setting[]
|
||||
$events: Function[]
|
||||
$formatted: boolean
|
||||
} & Omit<T, 'html' | 'icon' | 'tooltip'>
|
||||
|
||||
export type SettingOption = Props<Setting>;
|
||||
export type SettingOption = Props<Setting>
|
||||
|
||||
export type Setting = {
|
||||
/**
|
||||
* Html string or html element of setting name
|
||||
*/
|
||||
html: string | HTMLElement;
|
||||
export interface Setting {
|
||||
/**
|
||||
* Html string or html element of setting name
|
||||
*/
|
||||
html: string | HTMLElement
|
||||
|
||||
/**
|
||||
* Html string or html element of setting icon
|
||||
*/
|
||||
icon?: string | HTMLElement;
|
||||
/**
|
||||
* Html string or html element of setting icon
|
||||
*/
|
||||
icon?: string | HTMLElement
|
||||
|
||||
/**
|
||||
* The width of setting
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* The width of setting
|
||||
*/
|
||||
width?: number
|
||||
|
||||
/**
|
||||
* The tooltip of setting
|
||||
*/
|
||||
tooltip?: string | HTMLElement;
|
||||
/**
|
||||
* The tooltip of setting
|
||||
*/
|
||||
tooltip?: string | HTMLElement
|
||||
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean;
|
||||
/**
|
||||
* Whether the default is selected
|
||||
*/
|
||||
default?: boolean
|
||||
|
||||
/**
|
||||
* Custom selector list
|
||||
*/
|
||||
selector?: Setting[];
|
||||
/**
|
||||
* Custom selector list
|
||||
*/
|
||||
selector?: Setting[]
|
||||
|
||||
/**
|
||||
* When the setting was mounted
|
||||
*/
|
||||
mounted?(this: Artplayer, panel: HTMLDivElement, item: Setting): void;
|
||||
/**
|
||||
* When the setting was mounted
|
||||
*/
|
||||
mounted?: (this: Artplayer, panel: HTMLDivElement, item: Setting) => void
|
||||
|
||||
/**
|
||||
* When selector item click
|
||||
*/
|
||||
onSelect?(this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event): void;
|
||||
/**
|
||||
* When selector item click
|
||||
*/
|
||||
onSelect?: (this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event) => void
|
||||
|
||||
/**
|
||||
* Custom switch item
|
||||
*/
|
||||
switch?: boolean;
|
||||
/**
|
||||
* Custom switch item
|
||||
*/
|
||||
switch?: boolean
|
||||
|
||||
/**
|
||||
* When switch item click
|
||||
*/
|
||||
onSwitch?(this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event): void;
|
||||
/**
|
||||
* When switch item click
|
||||
*/
|
||||
onSwitch?: (this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event) => void
|
||||
|
||||
/**
|
||||
* Custom range item
|
||||
*/
|
||||
range?: [value?: number, min?: number, max?: number, step?: number];
|
||||
/**
|
||||
* Custom range item
|
||||
*/
|
||||
range?: [value?: number, min?: number, max?: number, step?: number]
|
||||
|
||||
/**
|
||||
* When range item change
|
||||
*/
|
||||
onRange?(this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event): void;
|
||||
/**
|
||||
* When range item change
|
||||
*/
|
||||
onRange?: (this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event) => void
|
||||
|
||||
/**
|
||||
* When range item change in real time
|
||||
*/
|
||||
onChange?(this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event): void;
|
||||
/**
|
||||
* When range item change in real time
|
||||
*/
|
||||
onChange?: (this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event) => void
|
||||
|
||||
/**
|
||||
* When range item change in real time
|
||||
*/
|
||||
onClick?(this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event): void;
|
||||
/**
|
||||
* When range item change in real time
|
||||
*/
|
||||
onClick?: (this: Artplayer, item: SettingOption, element: HTMLDivElement, event: Event) => void
|
||||
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any
|
||||
}
|
||||
+30
-30
@@ -1,36 +1,36 @@
|
||||
export type Subtitle = {
|
||||
/**
|
||||
* The subtitle url
|
||||
*/
|
||||
url?: string;
|
||||
export interface Subtitle {
|
||||
/**
|
||||
* The subtitle url
|
||||
*/
|
||||
url?: string
|
||||
|
||||
/**
|
||||
* The subtitle name
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The subtitle name
|
||||
*/
|
||||
name?: string
|
||||
|
||||
/**
|
||||
* The subtitle type
|
||||
*/
|
||||
type?: 'vtt' | 'srt' | 'ass' | (string & Record<never, never>);
|
||||
/**
|
||||
* The subtitle type
|
||||
*/
|
||||
type?: 'vtt' | 'srt' | 'ass' | (string & Record<never, never>)
|
||||
|
||||
/**
|
||||
* The subtitle style object
|
||||
*/
|
||||
style?: Partial<CSSStyleDeclaration>;
|
||||
/**
|
||||
* The subtitle style object
|
||||
*/
|
||||
style?: Partial<CSSStyleDeclaration>
|
||||
|
||||
/**
|
||||
* The subtitle encoding, default utf-8
|
||||
*/
|
||||
encoding?: string;
|
||||
/**
|
||||
* The subtitle encoding, default utf-8
|
||||
*/
|
||||
encoding?: string
|
||||
|
||||
/**
|
||||
* Whether use escape, default true
|
||||
*/
|
||||
escape?: boolean;
|
||||
/**
|
||||
* Whether use escape, default true
|
||||
*/
|
||||
escape?: boolean
|
||||
|
||||
/**
|
||||
* Change the vtt text
|
||||
*/
|
||||
onVttLoad?(vtt: string): string;
|
||||
};
|
||||
/**
|
||||
* Change the vtt text
|
||||
*/
|
||||
onVttLoad?: (vtt: string) => string
|
||||
}
|
||||
+26
-26
@@ -1,26 +1,26 @@
|
||||
export type Template = {
|
||||
readonly $container: HTMLDivElement;
|
||||
readonly $player: HTMLDivElement;
|
||||
readonly $video: HTMLVideoElement;
|
||||
readonly $track: HTMLTrackElement;
|
||||
readonly $poster: HTMLDivElement;
|
||||
readonly $subtitle: HTMLDivElement;
|
||||
readonly $danmuku: HTMLDivElement;
|
||||
readonly $bottom: HTMLDivElement;
|
||||
readonly $progress: HTMLDivElement;
|
||||
readonly $controls: HTMLDivElement;
|
||||
readonly $controlsLeft: HTMLDivElement;
|
||||
readonly $controlsRight: HTMLDivElement;
|
||||
readonly $layer: HTMLDivElement;
|
||||
readonly $loading: HTMLDivElement;
|
||||
readonly $notice: HTMLDivElement;
|
||||
readonly $noticeInner: HTMLDivElement;
|
||||
readonly $mask: HTMLDivElement;
|
||||
readonly $state: HTMLDivElement;
|
||||
readonly $setting: HTMLDivElement;
|
||||
readonly $info: HTMLDivElement;
|
||||
readonly $infoPanel: HTMLDivElement;
|
||||
readonly $infoClose: HTMLDivElement;
|
||||
readonly $contextmenu: HTMLDivElement;
|
||||
readonly $mini: HTMLDivElement;
|
||||
};
|
||||
export interface Template {
|
||||
readonly $container: HTMLDivElement
|
||||
readonly $player: HTMLDivElement
|
||||
readonly $video: HTMLVideoElement
|
||||
readonly $track: HTMLTrackElement
|
||||
readonly $poster: HTMLDivElement
|
||||
readonly $subtitle: HTMLDivElement
|
||||
readonly $danmuku: HTMLDivElement
|
||||
readonly $bottom: HTMLDivElement
|
||||
readonly $progress: HTMLDivElement
|
||||
readonly $controls: HTMLDivElement
|
||||
readonly $controlsLeft: HTMLDivElement
|
||||
readonly $controlsRight: HTMLDivElement
|
||||
readonly $layer: HTMLDivElement
|
||||
readonly $loading: HTMLDivElement
|
||||
readonly $notice: HTMLDivElement
|
||||
readonly $noticeInner: HTMLDivElement
|
||||
readonly $mask: HTMLDivElement
|
||||
readonly $state: HTMLDivElement
|
||||
readonly $setting: HTMLDivElement
|
||||
readonly $info: HTMLDivElement
|
||||
readonly $infoPanel: HTMLDivElement
|
||||
readonly $infoClose: HTMLDivElement
|
||||
readonly $contextmenu: HTMLDivElement
|
||||
readonly $mini: HTMLDivElement
|
||||
}
|
||||
Vendored
+57
-57
@@ -1,57 +1,57 @@
|
||||
export type Utils = {
|
||||
userAgent: string;
|
||||
isMobile: boolean;
|
||||
isSafari: boolean;
|
||||
isWechat: boolean;
|
||||
isIE: boolean;
|
||||
isAndroid: boolean;
|
||||
isIOS: boolean;
|
||||
isIOS13: boolean;
|
||||
query(selector: string, parent?: HTMLElement): HTMLElement;
|
||||
queryAll(selector: string, parent?: HTMLElement): HTMLElement[];
|
||||
addClass(target: HTMLElement, className: string): void;
|
||||
removeClass(target: HTMLElement, className: string): void;
|
||||
hasClass(target: HTMLElement, className: string): boolean;
|
||||
append(target: HTMLElement, className: HTMLElement): HTMLElement;
|
||||
remove(target: HTMLElement): void;
|
||||
setStyle<T extends keyof CSSStyleDeclaration>(
|
||||
element: HTMLElement,
|
||||
key: T,
|
||||
value: CSSStyleDeclaration[T],
|
||||
): HTMLElement;
|
||||
setStyles(element: HTMLElement, styles: Partial<CSSStyleDeclaration>): HTMLElement;
|
||||
getStyle<T, K extends keyof CSSStyleDeclaration>(
|
||||
element: HTMLElement,
|
||||
key: K,
|
||||
numberType?: T,
|
||||
): T extends true ? number : string;
|
||||
siblings(target: HTMLElement): HTMLElement[];
|
||||
inverseClass(target: HTMLElement, className: string): void;
|
||||
tooltip(target: HTMLElement, msg: string, pos?: string): void;
|
||||
isInViewport(target: HTMLElement, offset?: number): boolean;
|
||||
includeFromEvent(event: Event, target: HTMLElement): boolean;
|
||||
replaceElement(newChild: HTMLElement, oldChild: HTMLElement): HTMLElement;
|
||||
createElement(tag: keyof HTMLElementTagNameMap): HTMLElement;
|
||||
errorHandle<T extends boolean>(condition: T, msg: string): T extends true ? T : never;
|
||||
srtToVtt(srtText: string): string;
|
||||
vttToBlob(vttText: string): string;
|
||||
assToVtt(assText: string): string;
|
||||
getExt(url: string): string;
|
||||
download(url: string, name: string): void;
|
||||
def(obj: object, name: string, value: any): void;
|
||||
has(obj: object, name: string): boolean;
|
||||
get(obj: object, name: string): PropertyDescriptor;
|
||||
mergeDeep<T>(...args: T[]): T;
|
||||
sleep(ms: number): Promise<null>;
|
||||
debounce(func: (...arg: any[]) => any, wait: number, context?: object): (...arg: any[]) => any;
|
||||
throttle(func: (...arg: any[]) => any, wait: number): (...arg: any[]) => any;
|
||||
clamp(num: number, a: number, b: number): number;
|
||||
secondToTime(second: number): string;
|
||||
escape(str: string): string;
|
||||
capitalize(str: string): string;
|
||||
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 interface Utils {
|
||||
userAgent: string
|
||||
isMobile: boolean
|
||||
isSafari: boolean
|
||||
isWechat: boolean
|
||||
isIE: boolean
|
||||
isAndroid: boolean
|
||||
isIOS: boolean
|
||||
isIOS13: boolean
|
||||
query: (selector: string, parent?: HTMLElement) => HTMLElement
|
||||
queryAll: (selector: string, parent?: HTMLElement) => HTMLElement[]
|
||||
addClass: (target: HTMLElement, className: string) => void
|
||||
removeClass: (target: HTMLElement, className: string) => void
|
||||
hasClass: (target: HTMLElement, className: string) => boolean
|
||||
append: (target: HTMLElement, className: HTMLElement) => HTMLElement
|
||||
remove: (target: HTMLElement) => void
|
||||
setStyle: <T extends keyof CSSStyleDeclaration>(
|
||||
element: HTMLElement,
|
||||
key: T,
|
||||
value: CSSStyleDeclaration[T],
|
||||
) => HTMLElement
|
||||
setStyles: (element: HTMLElement, styles: Partial<CSSStyleDeclaration>) => HTMLElement
|
||||
getStyle: <T, K extends keyof CSSStyleDeclaration>(
|
||||
element: HTMLElement,
|
||||
key: K,
|
||||
numberType?: T,
|
||||
) => T extends true ? number : string
|
||||
siblings: (target: HTMLElement) => HTMLElement[]
|
||||
inverseClass: (target: HTMLElement, className: string) => void
|
||||
tooltip: (target: HTMLElement, msg: string, pos?: string) => void
|
||||
isInViewport: (target: HTMLElement, offset?: number) => boolean
|
||||
includeFromEvent: (event: Event, target: HTMLElement) => boolean
|
||||
replaceElement: (newChild: HTMLElement, oldChild: HTMLElement) => HTMLElement
|
||||
createElement: (tag: keyof HTMLElementTagNameMap) => HTMLElement
|
||||
errorHandle: <T extends boolean>(condition: T, msg: string) => T extends true ? T : never
|
||||
srtToVtt: (srtText: string) => string
|
||||
vttToBlob: (vttText: string) => string
|
||||
assToVtt: (assText: string) => string
|
||||
getExt: (url: string) => string
|
||||
download: (url: string, name: string) => void
|
||||
def: (obj: object, name: string, value: any) => void
|
||||
has: (obj: object, name: string) => boolean
|
||||
get: (obj: object, name: string) => PropertyDescriptor
|
||||
mergeDeep: <T>(...args: T[]) => T
|
||||
sleep: (ms: number) => Promise<null>
|
||||
debounce: (func: (...arg: any[]) => any, wait: number, context?: object) => (...arg: any[]) => any
|
||||
throttle: (func: (...arg: any[]) => any, wait: number) => (...arg: any[]) => any
|
||||
clamp: (num: number, a: number, b: number) => number
|
||||
secondToTime: (second: number) => string
|
||||
escape: (str: string) => string
|
||||
capitalize: (str: string) => string
|
||||
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>
|
||||
}
|
||||
Reference in new issue
Block a user