Refactor code structure for improved readability and maintainability

feat: add JASSUB type definitions and update common.js references

feat: add JASSUB plugin for advanced subtitle rendering in HTML5 video

- Implemented a new JASSUB class for handling subtitle rendering with options for video and canvas targets.
- Added support for both synchronous and asynchronous rendering modes.
- Integrated Web Worker for offloading rendering tasks, improving performance.
- Included methods for managing subtitle tracks, styles, and events.
- Added color space verification and handling to ensure accurate subtitle display.
- Implemented local font access for enhanced typography options in subtitles.
- Introduced a benchmarking feature to assess rendering performance.

refactor: update README and type definitions for artplayer-plugin-jassub

- Removed installation and usage instructions from README.md for clarity.
- Updated index.js to remove direct assignment of jassub instance to art.
- Enhanced type definitions in artplayer-plugin-jassub.d.ts to include detailed JassubOption and JassubInstance interfaces.
This commit is contained in:
Harvey Zhao committed 2026-01-03 18:56:06 +08:00
1 parent ce35026cb4
commit f4d99eb09e
27 files changed
+8315 -55

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
export interface JassubOption {
workerUrl: string
wasmUrl: string
modernWasmUrl: string
subUrl?: string
subContent?: string
timeOffset?: number
debug?: boolean
prescaleFactor?: number
prescaleHeightLimit?: number
maxRenderHeight?: number
fonts?: string[] | Uint8Array[]
availableFonts?: Record<string, Uint8Array | string>
fallbackFont?: string
useLocalFonts?: boolean
libassMemoryLimit?: number
libassGlyphLimit?: number
[key: string]: any
}
export interface JassubInstance {
resize: (force?: boolean, width?: number, height?: number, top?: number, left?: number) => Promise<void>
setVideo: (video: HTMLVideoElement) => Promise<void>
destroy: () => Promise<void>
[key: string]: any
}
interface Result {
name: 'artplayerPluginJassub'
instance: JassubInstance
}
declare const artplayerPluginJassub: (option: JassubOption) => (art: Artplayer) => Result
export default artplayerPluginJassub
export = artplayerPluginJassub
export as namespace artplayerPluginJassub;
-22
View File
@@ -853,28 +853,15 @@ export interface CssVar {
'--art-theme': string
'--art-font-color': string
'--art-background-color': string
'--art-font-size-sm': string
'--art-text-shadow-color': string
'--art-transition-duration': string
'--art-ease-standard': string
'--art-padding': string
'--art-border-radius': string
'--art-mobile-padding': string
'--art-mobile-radius': string
'--art-radius-sm': string
'--art-space-xxs': string
'--art-space-xs': string
'--art-surface-hover-color': string
'--art-surface-border-color': string
'--art-surface-muted-color': string
'--art-surface-range-color': string
'--art-progress-height': string
'--art-progress-color': string
'--art-progress-top-gap': string
'--art-hover-color': string
'--art-loaded-color': string
'--art-tip-padding': string
'--art-tip-offset': string
'--art-state-size': string
'--art-state-opacity': number
'--art-bottom-height': string
@@ -886,7 +873,6 @@ export interface CssVar {
'--art-control-opacity': number
'--art-control-icon-size': string
'--art-control-icon-scale': number
'--art-touch-hit-size': string
'--art-volume-height': string
'--art-volume-handle-size': string
'--art-lock-size': string
@@ -897,7 +883,6 @@ export interface CssVar {
'--art-settings-max-height': string
'--art-selector-max-height': string
'--art-contextmenus-min-width': string
'--art-contextmenu-padding-x': string
'--art-subtitle-font-size': string
'--art-subtitle-gap': string
'--art-subtitle-bottom': string
@@ -908,13 +893,6 @@ export interface CssVar {
'--art-scrollbar-background': string
'--art-scrollbar-background-hover': string
'--art-mini-progress-height': string
'--art-shadow-low': string
'--art-shadow-medium': string
'--art-shadow-high': string
'--art-shadow-elevated': string
'--art-icon-small-size': string
'--art-overlay-dim': string
'--art-overlay-strong': string
}
export interface Config {