mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
feat: add danmuku plugin documentation and i18n setup instructions
- Created a new documentation file for the danmuku plugin with code examples. - Added comprehensive language settings documentation, including default languages, importing languages, adding new languages, and modifying existing languages. - Updated the i18n setup examples to reflect the latest changes in language handling.
This commit is contained in:
1 parent
9d966bf696
commit
e947be8a8e
67 files changed
+216
-198
No files matched your search
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAds
|
||||
export as namespace artplayerPluginAds;
|
||||
|
||||
interface Option {
|
||||
/**
|
||||
* 广告源文本,支持视频链接、图片链接、HTML文本
|
||||
@@ -50,3 +45,8 @@ interface Ads {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
|
||||
|
||||
export default artplayerPluginAds
|
||||
|
||||
export = artplayerPluginAds;
|
||||
export as namespace artplayerPluginAds;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAmbilight
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
|
||||
interface Option {
|
||||
blur?: string
|
||||
opacity?: number
|
||||
@@ -18,3 +13,8 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginAmbilight
|
||||
|
||||
export = artplayerPluginAmbilight;
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
+3
-2
@@ -1,5 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAsr
|
||||
export as namespace artplayerPluginAsr;
|
||||
|
||||
@@ -24,3 +22,6 @@ interface AsrPluginInstance {
|
||||
}
|
||||
|
||||
declare function artplayerPluginAsr(option?: AsrPluginOption): (art: Artplayer) => AsrPluginInstance
|
||||
|
||||
export = artplayerPluginAsr;
|
||||
export as namespace artplayerPluginAsr;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAutoThumbnail
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
|
||||
interface Option {
|
||||
url?: string
|
||||
width?: number
|
||||
@@ -15,3 +10,8 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginAutoThumbnail
|
||||
|
||||
export = artplayerPluginAutoThumbnail;
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginChapter
|
||||
export as namespace artplayerPluginChapter;
|
||||
|
||||
type Chapters = {
|
||||
start: number
|
||||
end: number
|
||||
@@ -19,3 +14,8 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginChapter
|
||||
|
||||
export = artplayerPluginChapter;
|
||||
export as namespace artplayerPluginChapter;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginChromecast
|
||||
export as namespace artplayerPluginChromecast;
|
||||
|
||||
interface Option {
|
||||
url?: string
|
||||
sdk?: string
|
||||
@@ -15,3 +10,8 @@ interface Chromecast {
|
||||
}
|
||||
|
||||
declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) => Chromecast
|
||||
|
||||
export default artplayerPluginChromecast
|
||||
|
||||
export = artplayerPluginChromecast;
|
||||
export as namespace artplayerPluginChromecast;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDanmukuMask
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
|
||||
interface Option {
|
||||
solutionPath?: string
|
||||
modelSelection?: number
|
||||
@@ -23,3 +18,8 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginDanmukuMask
|
||||
|
||||
export = artplayerPluginDanmukuMask;
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDanmuku
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
|
||||
type Mode = 0 | 1 | 2
|
||||
type Danmuku = Danmu[] | string | (() => Promise<Danmu[]>) | Promise<Danmu[]>
|
||||
|
||||
@@ -253,3 +248,8 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginDanmuku
|
||||
|
||||
export = artplayerPluginDanmuku;
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDashControl
|
||||
export as namespace artplayerPluginDashControl;
|
||||
|
||||
interface Config {
|
||||
control?: boolean
|
||||
setting?: boolean
|
||||
@@ -15,3 +10,8 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C
|
||||
name: 'artplayerPluginDashControl'
|
||||
update: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginDashControl
|
||||
|
||||
export = artplayerPluginDashControl;
|
||||
export as namespace artplayerPluginDashControl;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginHlsControl
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
|
||||
interface Config {
|
||||
control?: boolean
|
||||
setting?: boolean
|
||||
@@ -15,3 +10,8 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co
|
||||
name: 'artplayerPluginHlsControl'
|
||||
update: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginHlsControl
|
||||
|
||||
export = artplayerPluginHlsControl;
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
+6
-4
@@ -1,6 +1,3 @@
|
||||
export = ArtplayerPluginIframe
|
||||
export as namespace ArtplayerPluginIframe;
|
||||
|
||||
interface Message {
|
||||
type: string
|
||||
data: any
|
||||
@@ -15,7 +12,7 @@ declare class ArtplayerPluginIframe {
|
||||
static onMessage(event: MessageEvent & { data: Message }): void
|
||||
static inject(): void
|
||||
|
||||
readonly promises: Record<number, { resove: Function, reject: Function }>
|
||||
readonly promises: Record<number, { resove: (...args: any[]) => any, reject: (...args: any[]) => any }>
|
||||
readonly injected: boolean
|
||||
readonly destroyed: boolean
|
||||
readonly $iframe: HTMLIFrameElement
|
||||
@@ -28,3 +25,8 @@ declare class ArtplayerPluginIframe {
|
||||
message(callback: (...args: any[]) => any): void
|
||||
destroy(): void
|
||||
}
|
||||
|
||||
export default ArtplayerPluginIframe
|
||||
|
||||
export = artplayerPluginIframe;
|
||||
export as namespace artplayerPluginIframe;
|
||||
+5
-7
@@ -1,10 +1,3 @@
|
||||
import type SubtitlesOctopus from '@hrgui/libass-wasm-ts'
|
||||
import type Artplayer from 'artplayer'
|
||||
import type { Options } from 'libass-wasm'
|
||||
|
||||
export = artplayerPluginAss
|
||||
export as namespace artplayerPluginAss;
|
||||
|
||||
declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginLibass'
|
||||
libass: SubtitlesOctopus
|
||||
@@ -15,3 +8,8 @@ declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
|
||||
hide: () => void
|
||||
destroy: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginAss
|
||||
|
||||
export = artplayerPluginLibass;
|
||||
export as namespace artplayerPluginLibass;
|
||||
+5
-5
@@ -1,8 +1,3 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginMultipleSubtitles
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
|
||||
declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
subtitles: {
|
||||
url?: string
|
||||
@@ -14,3 +9,8 @@ declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'multipleSubtitles'
|
||||
}
|
||||
|
||||
export default artplayerPluginMultipleSubtitles
|
||||
|
||||
export = artplayerPluginMultipleSubtitles;
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
+3
-3
@@ -1,6 +1,3 @@
|
||||
import type { Player } from '@glomex/vast-ima-player'
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginVast
|
||||
export as namespace artplayerPluginVast;
|
||||
|
||||
@@ -32,3 +29,6 @@ export interface ArtplayerPluginVastInstance {
|
||||
declare function artplayerPluginVast(
|
||||
option: ArtplayerPluginVastOption,
|
||||
): (art: Artplayer) => ArtplayerPluginVastInstance
|
||||
|
||||
export = artplayerPluginVast;
|
||||
export as namespace artplayerPluginVast;
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginVttThumbnail
|
||||
export as namespace artplayerPluginVttThumbnail;
|
||||
|
||||
declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Partial<CSSStyleDeclaration> }) => (
|
||||
art: Artplayer,
|
||||
) => {
|
||||
name: 'artplayerPluginVttThumbnail'
|
||||
}
|
||||
|
||||
export default artplayerPluginVttThumbnail
|
||||
|
||||
export = artplayerPluginVttThumbnail;
|
||||
export as namespace artplayerPluginVttThumbnail;
|
||||
Vendored
+41
-40
@@ -120,7 +120,7 @@ export interface Subtitle {
|
||||
onVttLoad?: (vtt: string) => string
|
||||
}
|
||||
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
|
||||
type Props<T> = {
|
||||
html: string
|
||||
@@ -135,7 +135,7 @@ type Props<T> = {
|
||||
$parent: Setting
|
||||
$parents: Setting[]
|
||||
$option: Setting[]
|
||||
$events: Function[]
|
||||
$events: Array<(...args: any[]) => any>
|
||||
$formatted: boolean
|
||||
} & Omit<T, 'html' | 'icon' | 'tooltip'>
|
||||
|
||||
@@ -232,9 +232,9 @@ export interface Quality {
|
||||
url: string
|
||||
}
|
||||
|
||||
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>)
|
||||
@@ -259,10 +259,8 @@ export declare class Player {
|
||||
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
|
||||
@@ -281,8 +279,11 @@ export declare class Player {
|
||||
get x(): number
|
||||
get y(): number
|
||||
set seek(time: number)
|
||||
get seek(): number
|
||||
set forward(time: number)
|
||||
get forward(): number
|
||||
set backward(time: number)
|
||||
get backward(): number
|
||||
get url(): string
|
||||
set url(url: string)
|
||||
get volume(): number
|
||||
@@ -296,7 +297,9 @@ export declare class Player {
|
||||
get subtitleOffset(): number
|
||||
set subtitleOffset(time: number)
|
||||
set switch(url: string)
|
||||
get switch(): string
|
||||
set quality(quality: Quality[])
|
||||
get quality(): Quality[]
|
||||
get thumbnails(): Thumbnails
|
||||
set thumbnails(thumbnails: Thumbnails)
|
||||
pause(): void
|
||||
@@ -314,14 +317,14 @@ export declare class Player {
|
||||
autoHeight(): void
|
||||
}
|
||||
|
||||
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>)
|
||||
|
||||
@@ -597,7 +600,7 @@ export interface Option {
|
||||
* Other video attribute
|
||||
*/
|
||||
moreVideoAttr?: Partial<{
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends Function ? never : key]: HTMLVideoElement[key];
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends (...args: any[]) => any ? never : key]: HTMLVideoElement[key];
|
||||
}>
|
||||
|
||||
/**
|
||||
@@ -625,8 +628,6 @@ export interface Option {
|
||||
>
|
||||
}
|
||||
|
||||
export default Option
|
||||
|
||||
export interface Icons {
|
||||
readonly loading: HTMLDivElement
|
||||
readonly state: HTMLDivElement
|
||||
@@ -715,8 +716,8 @@ interface I18nValue {
|
||||
|
||||
export type I18n = Partial<Record<I18nKeys, Partial<I18nValue>>>
|
||||
|
||||
import type { AspectRatio, Flip } from './player'
|
||||
import type { Subtitle } from './subtitle'
|
||||
|
||||
|
||||
|
||||
export type Bar = 'loaded' | 'played' | 'hover'
|
||||
|
||||
@@ -918,7 +919,7 @@ export interface Config {
|
||||
]
|
||||
}
|
||||
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
|
||||
export interface Selector {
|
||||
/**
|
||||
@@ -1041,22 +1042,19 @@ export interface ComponentOption {
|
||||
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
|
||||
}
|
||||
|
||||
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 as namespace Artplayer;
|
||||
|
||||
declare class Artplayer extends Player {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default class Artplayer extends Player {
|
||||
constructor(option: Option, readyCallback?: (this: Artplayer, art: Artplayer) => unknown)
|
||||
|
||||
get Config(): Config
|
||||
@@ -1079,7 +1077,7 @@ declare class Artplayer extends Player {
|
||||
static readonly config: Config
|
||||
static readonly utils: Utils
|
||||
static readonly scheme: Record<keyof Option, any>
|
||||
static readonly Emitter: Function
|
||||
static readonly Emitter: (...args: any[]) => any
|
||||
static readonly validator: <T extends object>(option: T, scheme: object) => T
|
||||
static readonly kindOf: (item: any) => string
|
||||
static readonly html: Artplayer['template']['html']
|
||||
@@ -1138,13 +1136,13 @@ declare class Artplayer extends Player {
|
||||
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
|
||||
off<T extends keyof Events>(name: T, callback?: ((...args: Events[T]) => unknown)): unknown
|
||||
|
||||
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: (...args: any[]) => any, ctx: unknown }[]>
|
||||
|
||||
destroy(removeHtml?: boolean): void
|
||||
|
||||
@@ -1209,7 +1207,7 @@ declare class Artplayer extends Player {
|
||||
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']
|
||||
remove: (key: string, callback: (event: Event) => any) => Artplayer['hotkey']
|
||||
}
|
||||
|
||||
readonly mask: Component
|
||||
@@ -1229,4 +1227,7 @@ declare class Artplayer extends Player {
|
||||
) => Promise<Artplayer['plugins']> | Artplayer['plugins']
|
||||
[pluginName: string]: any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = Artplayer;
|
||||
export as namespace Artplayer;
|
||||
Reference in new issue
Block a user