From cfaaea6a5c700f576683463776797c18abaffcc5 Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Thu, 12 Feb 2026 16:55:43 +0800 Subject: [PATCH] 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. --- docs/assets/example/websr.js | 2 + docs/assets/ts/artplayer-plugin-ads.d.ts | 4 +- .../assets/ts/artplayer-plugin-ambilight.d.ts | 4 +- docs/assets/ts/artplayer-plugin-asr.d.ts | 4 +- .../ts/artplayer-plugin-audio-track.d.ts | 4 +- .../ts/artplayer-plugin-auto-thumbnail.d.ts | 4 +- docs/assets/ts/artplayer-plugin-chapter.d.ts | 4 +- .../ts/artplayer-plugin-chromecast.d.ts | 4 +- .../ts/artplayer-plugin-danmuku-mask.d.ts | 4 +- docs/assets/ts/artplayer-plugin-danmuku.d.ts | 4 +- .../ts/artplayer-plugin-dash-control.d.ts | 4 +- .../ts/artplayer-plugin-document-pip.d.ts | 4 +- .../ts/artplayer-plugin-hls-control.d.ts | 4 +- docs/assets/ts/artplayer-plugin-iframe.d.ts | 4 +- docs/assets/ts/artplayer-plugin-jassub.d.ts | 4 +- .../artplayer-plugin-multiple-subtitles.d.ts | 4 +- docs/assets/ts/artplayer-plugin-vast.d.ts | 4 +- .../ts/artplayer-plugin-vtt-thumbnail.d.ts | 4 +- docs/assets/ts/artplayer-plugin-websr.d.ts | 97 ++--------- docs/assets/ts/artplayer-proxy-canvas.d.ts | 4 +- .../assets/ts/artplayer-proxy-mediabunny.d.ts | 4 +- docs/assets/ts/artplayer.d.ts | 36 +--- docs/compiled/artplayer-plugin-websr.js | 2 +- .../compiled/artplayer-plugin-websr.legacy.js | 2 +- docs/compiled/artplayer-plugin-websr.mjs | 2 +- docs/document/404.html | 2 +- docs/document/advanced/built-in.html | 2 +- docs/document/advanced/class.html | 2 +- docs/document/advanced/event.html | 2 +- docs/document/advanced/global.html | 2 +- docs/document/advanced/plugin.html | 2 +- docs/document/advanced/property.html | 2 +- ...md.CYpcDsY6.js => en_index.md.DrOcPBwp.js} | 10 +- ...6.lean.js => en_index.md.DrOcPBwp.lean.js} | 0 ...tw6CvN.js => en_start_i18n.md.DAxrpMQL.js} | 2 +- ...n.js => en_start_i18n.md.DAxrpMQL.lean.js} | 0 ...ex.md.B8NxRV94.js => index.md.WcEL7IA5.js} | 10 +- ...RV94.lean.js => index.md.WcEL7IA5.lean.js} | 0 ...HV45A.js => plugin_danmuku.md.D580Az0s.js} | 2 +- ....js => plugin_danmuku.md.D580Az0s.lean.js} | 0 ....B0XPxv4h.js => start_i18n.md.C6dAnYSp.js} | 2 +- ...lean.js => start_i18n.md.C6dAnYSp.lean.js} | 0 docs/document/component/contextmenu.html | 2 +- docs/document/component/controls.html | 2 +- docs/document/component/layers.html | 2 +- docs/document/component/setting.html | 2 +- docs/document/en/advanced/built-in.html | 2 +- docs/document/en/advanced/class.html | 2 +- docs/document/en/advanced/event.html | 2 +- docs/document/en/advanced/global.html | 2 +- docs/document/en/advanced/plugin.html | 2 +- docs/document/en/advanced/property.html | 2 +- docs/document/en/component/contextmenu.html | 2 +- docs/document/en/component/controls.html | 2 +- docs/document/en/component/layers.html | 2 +- docs/document/en/component/setting.html | 2 +- docs/document/en/index.html | 14 +- docs/document/en/start/i18n.html | 6 +- docs/document/en/start/option.html | 2 +- docs/document/hashmap.json | 2 +- docs/document/index.html | 14 +- docs/document/plugin/danmuku.html | 6 +- docs/document/start/i18n.html | 6 +- docs/document/start/option.html | 2 +- .../artplayer-plugin-websr/index.js | 163 ++++++++++++++---- .../artplayer-plugin-websr/index.js.map | 2 +- .../dist/artplayer-plugin-websr.js | 2 +- .../dist/artplayer-plugin-websr.legacy.js | 2 +- .../dist/artplayer-plugin-websr.mjs | 2 +- .../artplayer-plugin-websr/src/Upscaler.js | 85 ++++++--- packages/artplayer-plugin-websr/src/index.js | 148 +++++++++++++--- .../types/artplayer-plugin-websr.d.ts | 87 +--------- 72 files changed, 436 insertions(+), 392 deletions(-) rename docs/document/assets/{en_index.md.CYpcDsY6.js => en_index.md.DrOcPBwp.js} (96%) rename docs/document/assets/{en_index.md.CYpcDsY6.lean.js => en_index.md.DrOcPBwp.lean.js} (100%) rename docs/document/assets/{en_start_i18n.md.x4tw6CvN.js => en_start_i18n.md.DAxrpMQL.js} (98%) rename docs/document/assets/{en_start_i18n.md.x4tw6CvN.lean.js => en_start_i18n.md.DAxrpMQL.lean.js} (100%) rename docs/document/assets/{index.md.B8NxRV94.js => index.md.WcEL7IA5.js} (96%) rename docs/document/assets/{index.md.B8NxRV94.lean.js => index.md.WcEL7IA5.lean.js} (100%) rename docs/document/assets/{plugin_danmuku.md.C7LHV45A.js => plugin_danmuku.md.D580Az0s.js} (99%) rename docs/document/assets/{plugin_danmuku.md.C7LHV45A.lean.js => plugin_danmuku.md.D580Az0s.lean.js} (100%) rename docs/document/assets/{start_i18n.md.B0XPxv4h.js => start_i18n.md.C6dAnYSp.js} (98%) rename docs/document/assets/{start_i18n.md.B0XPxv4h.lean.js => start_i18n.md.C6dAnYSp.lean.js} (100%) diff --git a/docs/assets/example/websr.js b/docs/assets/example/websr.js index 0afe93119..e5574458e 100644 --- a/docs/assets/example/websr.js +++ b/docs/assets/example/websr.js @@ -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', diff --git a/docs/assets/ts/artplayer-plugin-ads.d.ts b/docs/assets/ts/artplayer-plugin-ads.d.ts index dd3cde90e..618fdd6c1 100644 --- a/docs/assets/ts/artplayer-plugin-ads.d.ts +++ b/docs/assets/ts/artplayer-plugin-ads.d.ts @@ -48,5 +48,5 @@ declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads export default artplayerPluginAds -export = artplayerPluginAds; -export as namespace artplayerPluginAds; \ No newline at end of file +export = artplayerPluginAds +export as namespace artplayerPluginAds; diff --git a/docs/assets/ts/artplayer-plugin-ambilight.d.ts b/docs/assets/ts/artplayer-plugin-ambilight.d.ts index 786b884f4..50abda15a 100644 --- a/docs/assets/ts/artplayer-plugin-ambilight.d.ts +++ b/docs/assets/ts/artplayer-plugin-ambilight.d.ts @@ -16,5 +16,5 @@ declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => export default artplayerPluginAmbilight -export = artplayerPluginAmbilight; -export as namespace artplayerPluginAmbilight; \ No newline at end of file +export = artplayerPluginAmbilight +export as namespace artplayerPluginAmbilight; diff --git a/docs/assets/ts/artplayer-plugin-asr.d.ts b/docs/assets/ts/artplayer-plugin-asr.d.ts index a134e7348..769e0b30f 100644 --- a/docs/assets/ts/artplayer-plugin-asr.d.ts +++ b/docs/assets/ts/artplayer-plugin-asr.d.ts @@ -22,5 +22,5 @@ declare function artplayerPluginAsr(option?: AsrPluginOption): (art: Artplayer) export default artplayerPluginAsr -export = artplayerPluginAsr; -export as namespace artplayerPluginAsr; \ No newline at end of file +export = artplayerPluginAsr +export as namespace artplayerPluginAsr; diff --git a/docs/assets/ts/artplayer-plugin-audio-track.d.ts b/docs/assets/ts/artplayer-plugin-audio-track.d.ts index aaddaa9cc..6d2dd469b 100644 --- a/docs/assets/ts/artplayer-plugin-audio-track.d.ts +++ b/docs/assets/ts/artplayer-plugin-audio-track.d.ts @@ -36,5 +36,5 @@ declare const artplayerPluginAudioTrack: (option: Option) => (art: Artplayer) => export default artplayerPluginAudioTrack -export = artplayerPluginAudioTrack; -export as namespace artplayerPluginAudioTrack; \ No newline at end of file +export = artplayerPluginAudioTrack +export as namespace artplayerPluginAudioTrack; diff --git a/docs/assets/ts/artplayer-plugin-auto-thumbnail.d.ts b/docs/assets/ts/artplayer-plugin-auto-thumbnail.d.ts index dff0302ce..e6f616aa0 100644 --- a/docs/assets/ts/artplayer-plugin-auto-thumbnail.d.ts +++ b/docs/assets/ts/artplayer-plugin-auto-thumbnail.d.ts @@ -13,5 +13,5 @@ declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) export default artplayerPluginAutoThumbnail -export = artplayerPluginAutoThumbnail; -export as namespace artplayerPluginAutoThumbnail; \ No newline at end of file +export = artplayerPluginAutoThumbnail +export as namespace artplayerPluginAutoThumbnail; diff --git a/docs/assets/ts/artplayer-plugin-chapter.d.ts b/docs/assets/ts/artplayer-plugin-chapter.d.ts index 0c16baa40..5d6f7b378 100644 --- a/docs/assets/ts/artplayer-plugin-chapter.d.ts +++ b/docs/assets/ts/artplayer-plugin-chapter.d.ts @@ -17,5 +17,5 @@ declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Re export default artplayerPluginChapter -export = artplayerPluginChapter; -export as namespace artplayerPluginChapter; \ No newline at end of file +export = artplayerPluginChapter +export as namespace artplayerPluginChapter; diff --git a/docs/assets/ts/artplayer-plugin-chromecast.d.ts b/docs/assets/ts/artplayer-plugin-chromecast.d.ts index 4d3aadd12..5069b042d 100644 --- a/docs/assets/ts/artplayer-plugin-chromecast.d.ts +++ b/docs/assets/ts/artplayer-plugin-chromecast.d.ts @@ -13,5 +13,5 @@ declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) => export default artplayerPluginChromecast -export = artplayerPluginChromecast; -export as namespace artplayerPluginChromecast; \ No newline at end of file +export = artplayerPluginChromecast +export as namespace artplayerPluginChromecast; diff --git a/docs/assets/ts/artplayer-plugin-danmuku-mask.d.ts b/docs/assets/ts/artplayer-plugin-danmuku-mask.d.ts index b2c996b79..68515f8f8 100644 --- a/docs/assets/ts/artplayer-plugin-danmuku-mask.d.ts +++ b/docs/assets/ts/artplayer-plugin-danmuku-mask.d.ts @@ -21,5 +21,5 @@ declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer) export default artplayerPluginDanmukuMask -export = artplayerPluginDanmukuMask; -export as namespace artplayerPluginDanmukuMask; \ No newline at end of file +export = artplayerPluginDanmukuMask +export as namespace artplayerPluginDanmukuMask; diff --git a/docs/assets/ts/artplayer-plugin-danmuku.d.ts b/docs/assets/ts/artplayer-plugin-danmuku.d.ts index 6f6a5ec04..554ce0fe2 100644 --- a/docs/assets/ts/artplayer-plugin-danmuku.d.ts +++ b/docs/assets/ts/artplayer-plugin-danmuku.d.ts @@ -255,5 +255,5 @@ declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Re export default artplayerPluginDanmuku -export = artplayerPluginDanmuku; -export as namespace artplayerPluginDanmuku; \ No newline at end of file +export = artplayerPluginDanmuku +export as namespace artplayerPluginDanmuku; diff --git a/docs/assets/ts/artplayer-plugin-dash-control.d.ts b/docs/assets/ts/artplayer-plugin-dash-control.d.ts index 35057bb07..39a52d129 100644 --- a/docs/assets/ts/artplayer-plugin-dash-control.d.ts +++ b/docs/assets/ts/artplayer-plugin-dash-control.d.ts @@ -13,5 +13,5 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C export default artplayerPluginDashControl -export = artplayerPluginDashControl; -export as namespace artplayerPluginDashControl; \ No newline at end of file +export = artplayerPluginDashControl +export as namespace artplayerPluginDashControl; diff --git a/docs/assets/ts/artplayer-plugin-document-pip.d.ts b/docs/assets/ts/artplayer-plugin-document-pip.d.ts index dee9d2c41..df061d9f4 100644 --- a/docs/assets/ts/artplayer-plugin-document-pip.d.ts +++ b/docs/assets/ts/artplayer-plugin-document-pip.d.ts @@ -18,5 +18,5 @@ declare const artplayerPluginDocumentPip: (option: Option) => (art: Artplayer) = export default artplayerPluginDocumentPip -export = artplayerPluginDocumentPip; -export as namespace artplayerPluginDocumentPip; \ No newline at end of file +export = artplayerPluginDocumentPip +export as namespace artplayerPluginDocumentPip; diff --git a/docs/assets/ts/artplayer-plugin-hls-control.d.ts b/docs/assets/ts/artplayer-plugin-hls-control.d.ts index 01c881339..f047513e8 100644 --- a/docs/assets/ts/artplayer-plugin-hls-control.d.ts +++ b/docs/assets/ts/artplayer-plugin-hls-control.d.ts @@ -13,5 +13,5 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co export default artplayerPluginHlsControl -export = artplayerPluginHlsControl; -export as namespace artplayerPluginHlsControl; \ No newline at end of file +export = artplayerPluginHlsControl +export as namespace artplayerPluginHlsControl; diff --git a/docs/assets/ts/artplayer-plugin-iframe.d.ts b/docs/assets/ts/artplayer-plugin-iframe.d.ts index f5ebf54f5..88cfd5bad 100644 --- a/docs/assets/ts/artplayer-plugin-iframe.d.ts +++ b/docs/assets/ts/artplayer-plugin-iframe.d.ts @@ -28,5 +28,5 @@ declare class ArtplayerPluginIframe { export default ArtplayerPluginIframe -export = artplayerPluginIframe; -export as namespace artplayerPluginIframe; \ No newline at end of file +export = artplayerPluginIframe +export as namespace artplayerPluginIframe; diff --git a/docs/assets/ts/artplayer-plugin-jassub.d.ts b/docs/assets/ts/artplayer-plugin-jassub.d.ts index 0239d173d..27e10fe86 100644 --- a/docs/assets/ts/artplayer-plugin-jassub.d.ts +++ b/docs/assets/ts/artplayer-plugin-jassub.d.ts @@ -34,5 +34,5 @@ declare const artplayerPluginJassub: (option: JassubOption) => (art: Artplayer) export default artplayerPluginJassub -export = artplayerPluginJassub; -export as namespace artplayerPluginJassub; \ No newline at end of file +export = artplayerPluginJassub +export as namespace artplayerPluginJassub; diff --git a/docs/assets/ts/artplayer-plugin-multiple-subtitles.d.ts b/docs/assets/ts/artplayer-plugin-multiple-subtitles.d.ts index 4d6161dff..a6f710bc1 100644 --- a/docs/assets/ts/artplayer-plugin-multiple-subtitles.d.ts +++ b/docs/assets/ts/artplayer-plugin-multiple-subtitles.d.ts @@ -12,5 +12,5 @@ declare const artplayerPluginMultipleSubtitles: (option: { export default artplayerPluginMultipleSubtitles -export = artplayerPluginMultipleSubtitles; -export as namespace artplayerPluginMultipleSubtitles; \ No newline at end of file +export = artplayerPluginMultipleSubtitles +export as namespace artplayerPluginMultipleSubtitles; diff --git a/docs/assets/ts/artplayer-plugin-vast.d.ts b/docs/assets/ts/artplayer-plugin-vast.d.ts index 7d526fd4b..a2a5fc121 100644 --- a/docs/assets/ts/artplayer-plugin-vast.d.ts +++ b/docs/assets/ts/artplayer-plugin-vast.d.ts @@ -32,5 +32,5 @@ declare function artplayerPluginVast( export default artplayerPluginVast -export = artplayerPluginVast; -export as namespace artplayerPluginVast; \ No newline at end of file +export = artplayerPluginVast +export as namespace artplayerPluginVast; diff --git a/docs/assets/ts/artplayer-plugin-vtt-thumbnail.d.ts b/docs/assets/ts/artplayer-plugin-vtt-thumbnail.d.ts index aaed1e528..4e8307e77 100644 --- a/docs/assets/ts/artplayer-plugin-vtt-thumbnail.d.ts +++ b/docs/assets/ts/artplayer-plugin-vtt-thumbnail.d.ts @@ -6,5 +6,5 @@ declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Part export default artplayerPluginVttThumbnail -export = artplayerPluginVttThumbnail; -export as namespace artplayerPluginVttThumbnail; \ No newline at end of file +export = artplayerPluginVttThumbnail +export as namespace artplayerPluginVttThumbnail; diff --git a/docs/assets/ts/artplayer-plugin-websr.d.ts b/docs/assets/ts/artplayer-plugin-websr.d.ts index a2adaaf32..8ddec2731 100644 --- a/docs/assets/ts/artplayer-plugin-websr.d.ts +++ b/docs/assets/ts/artplayer-plugin-websr.d.ts @@ -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; - /** - * Disable WebSR upscaling - */ - disable: () => void; - /** - * Toggle WebSR upscaling - */ - toggle: () => Promise; - /** - * 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