mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
feat: add danmuku plugin documentation and i18n setup guide
- Created a new documentation file for the danmuku plugin with code examples. - Added a comprehensive guide for language settings (i18n) including default languages, importing languages, adding new languages, and modifying existing languages. - Included code snippets for initializing the Artplayer with different language configurations.
This commit is contained in:
1 parent
687a34c6b3
commit
cfaaea6a5c
72 files changed
+436
-392
No files matched your search
@@ -1,3 +1,4 @@
|
||||
// https://github.com/sb2702/websr
|
||||
// npm i artplayer-plugin-websr
|
||||
// import artplayerPluginWebsr from 'artplayer-plugin-websr';
|
||||
|
||||
@@ -7,6 +8,7 @@ var art = new Artplayer({
|
||||
fullscreenWeb: true,
|
||||
plugins: [
|
||||
artplayerPluginWebsr({
|
||||
videoScale: 2,
|
||||
networkSize: 'medium',
|
||||
weightsBaseUrl: '/assets/websr/weights',
|
||||
workerUrl: '/assets/websr/worker/main.js',
|
||||
|
||||
+2
-2
@@ -48,5 +48,5 @@ declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
|
||||
|
||||
export default artplayerPluginAds
|
||||
|
||||
export = artplayerPluginAds;
|
||||
export as namespace artplayerPluginAds;
|
||||
export = artplayerPluginAds
|
||||
export as namespace artplayerPluginAds;
|
||||
+2
-2
@@ -16,5 +16,5 @@ declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) =>
|
||||
|
||||
export default artplayerPluginAmbilight
|
||||
|
||||
export = artplayerPluginAmbilight;
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
export = artplayerPluginAmbilight
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
+2
-2
@@ -22,5 +22,5 @@ declare function artplayerPluginAsr(option?: AsrPluginOption): (art: Artplayer)
|
||||
|
||||
export default artplayerPluginAsr
|
||||
|
||||
export = artplayerPluginAsr;
|
||||
export as namespace artplayerPluginAsr;
|
||||
export = artplayerPluginAsr
|
||||
export as namespace artplayerPluginAsr;
|
||||
+2
-2
@@ -36,5 +36,5 @@ declare const artplayerPluginAudioTrack: (option: Option) => (art: Artplayer) =>
|
||||
|
||||
export default artplayerPluginAudioTrack
|
||||
|
||||
export = artplayerPluginAudioTrack;
|
||||
export as namespace artplayerPluginAudioTrack;
|
||||
export = artplayerPluginAudioTrack
|
||||
export as namespace artplayerPluginAudioTrack;
|
||||
+2
-2
@@ -13,5 +13,5 @@ declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer)
|
||||
|
||||
export default artplayerPluginAutoThumbnail
|
||||
|
||||
export = artplayerPluginAutoThumbnail;
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
export = artplayerPluginAutoThumbnail
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
+2
-2
@@ -17,5 +17,5 @@ declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Re
|
||||
|
||||
export default artplayerPluginChapter
|
||||
|
||||
export = artplayerPluginChapter;
|
||||
export as namespace artplayerPluginChapter;
|
||||
export = artplayerPluginChapter
|
||||
export as namespace artplayerPluginChapter;
|
||||
+2
-2
@@ -13,5 +13,5 @@ declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) =>
|
||||
|
||||
export default artplayerPluginChromecast
|
||||
|
||||
export = artplayerPluginChromecast;
|
||||
export as namespace artplayerPluginChromecast;
|
||||
export = artplayerPluginChromecast
|
||||
export as namespace artplayerPluginChromecast;
|
||||
+2
-2
@@ -21,5 +21,5 @@ declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer)
|
||||
|
||||
export default artplayerPluginDanmukuMask
|
||||
|
||||
export = artplayerPluginDanmukuMask;
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
export = artplayerPluginDanmukuMask
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
+2
-2
@@ -255,5 +255,5 @@ declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Re
|
||||
|
||||
export default artplayerPluginDanmuku
|
||||
|
||||
export = artplayerPluginDanmuku;
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
export = artplayerPluginDanmuku
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
+2
-2
@@ -13,5 +13,5 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C
|
||||
|
||||
export default artplayerPluginDashControl
|
||||
|
||||
export = artplayerPluginDashControl;
|
||||
export as namespace artplayerPluginDashControl;
|
||||
export = artplayerPluginDashControl
|
||||
export as namespace artplayerPluginDashControl;
|
||||
+2
-2
@@ -18,5 +18,5 @@ declare const artplayerPluginDocumentPip: (option: Option) => (art: Artplayer) =
|
||||
|
||||
export default artplayerPluginDocumentPip
|
||||
|
||||
export = artplayerPluginDocumentPip;
|
||||
export as namespace artplayerPluginDocumentPip;
|
||||
export = artplayerPluginDocumentPip
|
||||
export as namespace artplayerPluginDocumentPip;
|
||||
+2
-2
@@ -13,5 +13,5 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co
|
||||
|
||||
export default artplayerPluginHlsControl
|
||||
|
||||
export = artplayerPluginHlsControl;
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
export = artplayerPluginHlsControl
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
+2
-2
@@ -28,5 +28,5 @@ declare class ArtplayerPluginIframe {
|
||||
|
||||
export default ArtplayerPluginIframe
|
||||
|
||||
export = artplayerPluginIframe;
|
||||
export as namespace artplayerPluginIframe;
|
||||
export = artplayerPluginIframe
|
||||
export as namespace artplayerPluginIframe;
|
||||
+2
-2
@@ -34,5 +34,5 @@ declare const artplayerPluginJassub: (option: JassubOption) => (art: Artplayer)
|
||||
|
||||
export default artplayerPluginJassub
|
||||
|
||||
export = artplayerPluginJassub;
|
||||
export as namespace artplayerPluginJassub;
|
||||
export = artplayerPluginJassub
|
||||
export as namespace artplayerPluginJassub;
|
||||
+2
-2
@@ -12,5 +12,5 @@ declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
|
||||
export default artplayerPluginMultipleSubtitles
|
||||
|
||||
export = artplayerPluginMultipleSubtitles;
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
export = artplayerPluginMultipleSubtitles
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
+2
-2
@@ -32,5 +32,5 @@ declare function artplayerPluginVast(
|
||||
|
||||
export default artplayerPluginVast
|
||||
|
||||
export = artplayerPluginVast;
|
||||
export as namespace artplayerPluginVast;
|
||||
export = artplayerPluginVast
|
||||
export as namespace artplayerPluginVast;
|
||||
+2
-2
@@ -6,5 +6,5 @@ declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Part
|
||||
|
||||
export default artplayerPluginVttThumbnail
|
||||
|
||||
export = artplayerPluginVttThumbnail;
|
||||
export as namespace artplayerPluginVttThumbnail;
|
||||
export = artplayerPluginVttThumbnail
|
||||
export as namespace artplayerPluginVttThumbnail;
|
||||
+11
-86
@@ -1,95 +1,20 @@
|
||||
interface Option {
|
||||
/**
|
||||
* Upscale factor
|
||||
* @default 2
|
||||
*/
|
||||
scale?: number;
|
||||
/**
|
||||
* Network name for upscaling (required)
|
||||
* e.g., 'anime4k/cnn-2x-m-an'
|
||||
*/
|
||||
networkName: string;
|
||||
/**
|
||||
* Weights for the neural network (required)
|
||||
* Can be a URL string or a pre-loaded weights object
|
||||
* e.g., '/path/to/weights.json' or { layers: [...] }
|
||||
*/
|
||||
weights: string | object;
|
||||
/**
|
||||
* Enable comparison mode
|
||||
* @default false
|
||||
*/
|
||||
compare?: boolean;
|
||||
compare?: boolean
|
||||
networkSize?: 'small' | 'medium' | 'large'
|
||||
weightsBaseUrl?: string
|
||||
workerUrl?: string
|
||||
videoScale?: number
|
||||
}
|
||||
|
||||
interface Result {
|
||||
name: 'artplayerPluginWebsr';
|
||||
/**
|
||||
* Get WebSR instance
|
||||
*/
|
||||
websr: () => any;
|
||||
/**
|
||||
* Get GPU context
|
||||
*/
|
||||
gpu: () => any;
|
||||
/**
|
||||
* Get canvas element
|
||||
*/
|
||||
canvas: () => HTMLCanvasElement;
|
||||
/**
|
||||
* Enable WebSR upscaling
|
||||
*/
|
||||
enable: () => Promise<void>;
|
||||
/**
|
||||
* Disable WebSR upscaling
|
||||
*/
|
||||
disable: () => void;
|
||||
/**
|
||||
* Toggle WebSR upscaling
|
||||
*/
|
||||
toggle: () => Promise<void>;
|
||||
/**
|
||||
* Check if WebSR is enabled
|
||||
*/
|
||||
isEnabled: () => boolean;
|
||||
/**
|
||||
* Check if WebSR is initialized
|
||||
*/
|
||||
isInitialized: () => boolean;
|
||||
/**
|
||||
* Update options at runtime
|
||||
* Supported options: enabled, weights, networkName, scale
|
||||
*/
|
||||
update: (option: Partial<Option>) => Promise<void>;
|
||||
/**
|
||||
* Enable comparison mode
|
||||
*/
|
||||
enableCompare: () => void;
|
||||
/**
|
||||
* Disable comparison mode
|
||||
*/
|
||||
disableCompare: () => void;
|
||||
/**
|
||||
* Toggle comparison mode
|
||||
*/
|
||||
toggleCompare: () => void;
|
||||
/**
|
||||
* Set comparison split position (0-1)
|
||||
*/
|
||||
setComparePosition: (pos: number) => void;
|
||||
/**
|
||||
* Get current comparison split position (0-1)
|
||||
*/
|
||||
getComparePosition: () => number;
|
||||
/**
|
||||
* Check if comparison mode is enabled
|
||||
*/
|
||||
isComparing: () => boolean;
|
||||
name: 'artplayerPluginWebsr'
|
||||
upscaler: any
|
||||
update: (option: Option) => void
|
||||
}
|
||||
|
||||
declare const artplayerPluginWebsr: (option?: Option) => (art: Artplayer) => Result;
|
||||
declare const artplayerPluginWebsr: (option?: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginWebsr
|
||||
|
||||
export = artplayerPluginWebsr;
|
||||
export as namespace artplayerPluginWebsr;
|
||||
export = artplayerPluginWebsr
|
||||
export as namespace artplayerPluginWebsr;
|
||||
+2
-2
@@ -6,5 +6,5 @@ declare const artplayerProxyCanvas: (option?: Option) => (art: Artplayer) => Res
|
||||
|
||||
export default artplayerProxyCanvas
|
||||
|
||||
export = artplayerProxyCanvas;
|
||||
export as namespace artplayerProxyCanvas;
|
||||
export = artplayerProxyCanvas
|
||||
export as namespace artplayerProxyCanvas;
|
||||
+2
-2
@@ -75,5 +75,5 @@ declare const artplayerProxyMediabunny: (option?: Option) => (art: Artplayer) =>
|
||||
|
||||
export default artplayerProxyMediabunny
|
||||
|
||||
export = artplayerProxyMediabunny;
|
||||
export as namespace artplayerProxyMediabunny;
|
||||
export = artplayerProxyMediabunny
|
||||
export as namespace artplayerProxyMediabunny;
|
||||
Vendored
+2
-34
@@ -126,8 +126,6 @@ export interface Subtitle {
|
||||
onVttLoad?: (vtt: string) => string
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface SettingOption extends Omit<Setting, 'html' | 'icon' | 'tooltip'> {
|
||||
html: string
|
||||
icon: string | undefined
|
||||
@@ -239,10 +237,6 @@ export interface Quality {
|
||||
url: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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>)
|
||||
@@ -352,15 +346,6 @@ export declare class Player {
|
||||
reset(): void
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export type CustomType
|
||||
= | 'flv'
|
||||
| 'm3u8'
|
||||
@@ -769,9 +754,6 @@ declare module 'artplayer/i18n/*' {
|
||||
export default lang
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export type Bar = 'loaded' | 'played' | 'hover'
|
||||
|
||||
export interface Events {
|
||||
@@ -995,8 +977,6 @@ export interface Config {
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface Selector {
|
||||
/**
|
||||
* Whether the default is selected
|
||||
@@ -1128,18 +1108,6 @@ export interface ComponentOption {
|
||||
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export type {
|
||||
Config,
|
||||
Events,
|
||||
@@ -1329,5 +1297,5 @@ export default class Artplayer extends Player {
|
||||
} & Record<string, unknown>
|
||||
}
|
||||
|
||||
export = Artplayer;
|
||||
export as namespace Artplayer;
|
||||
export = Artplayer
|
||||
export as namespace Artplayer;
|
||||
Reference in new issue
Block a user