feat: add danmuku plugin documentation and i18n setup guide

- Created a new documentation file for the danmuku plugin, detailing its usage and providing code examples.
- Added a comprehensive guide for language settings (i18n), including instructions for importing languages, setting default languages, and modifying language options.
- Included code snippets for initializing the Artplayer with different languages and examples for adding new languages.
This commit is contained in:
Harvey Zack committed 2025-08-01 09:34:07 +08:00
1 parent c1fe0e2b03
commit 5337f9b075
181 files changed
+1680 -1659

No files matched your search

+25 -11
View File
@@ -1,20 +1,34 @@
import type Artplayer from 'artplayer';
import { Player } from '@glomex/vast-ima-player';
export = artplayerPluginVast;
export as namespace artplayerPluginVast;
type Option = (params: {
declare global {
interface Window {
artplayerPluginVast?: typeof artplayerPluginVast;
}
}
type PlayUrlFn = (url: string) => void;
type PlayResFn = (res: string) => void;
interface VastPluginContext {
art: Artplayer;
id: string;
ima: any;
imaPlayer: any;
$container: HTMLDivElement;
playUrl: (url: string) => void;
playRes: (res: string) => void;
}) => void;
ima: typeof google.ima;
imaPlayer: Player;
playUrl: PlayUrlFn;
playRes: PlayResFn;
container: HTMLDivElement | null;
}
type Result = {
export type ArtplayerPluginVastOption = (params: VastPluginContext) => void | Promise<void>;
export interface ArtplayerPluginVastInstance {
name: 'artplayerPluginVast';
};
destroy?: () => void;
}
declare const artplayerPluginVast: (option: Option) => (art: Artplayer) => Result;
declare function artplayerPluginVast(
option: ArtplayerPluginVastOption,
): (art: Artplayer) => ArtplayerPluginVastInstance;
+9 -6
View File
@@ -25,7 +25,7 @@ export type Utils = {
key: K,
numberType?: T,
): T extends true ? number : string;
sublings(target: HTMLElement): HTMLElement[];
siblings(target: HTMLElement): HTMLElement[];
inverseClass(target: HTMLElement, className: string): void;
tooltip(target: HTMLElement, msg: string, pos?: string): void;
isInViewport(target: HTMLElement, offset?: number): boolean;
@@ -173,7 +173,7 @@ export type Setting = {
selector?: Setting[];
/**
* Wnen the setting was mounted
* When the setting was mounted
*/
mounted?(this: Artplayer, panel: HTMLDivElement, item: Setting): void;
@@ -215,7 +215,7 @@ export type Setting = {
[key: string]: any;
};
export type quality = {
export type Quality = {
/**
* Whether the default is selected
*/
@@ -296,7 +296,7 @@ export declare class Player {
get subtitleOffset(): number;
set subtitleOffset(time: number);
set switch(url: string);
set quality(quality: quality[]);
set quality(quality: Quality[]);
get thumbnails(): Thumbnails;
set thumbnails(thumbnails: Thumbnails);
pause(): void;
@@ -566,7 +566,7 @@ export type Option = {
/**
* Custom video quality list
*/
quality?: quality[];
quality?: Quality[];
/**
* Custom highlight list
@@ -834,7 +834,10 @@ export type CssVar = {
};
export type Config = {
propertys: [
/**
* Supported video properties
*/
properties: [
'audioTracks',
'autoplay',
'buffered',