-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.d.ts
117 lines (97 loc) · 2.72 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
interface ASS_Event {
Start: number;
Duration: number;
Style: string;
Name: string;
MarginL: number;
MarginR: number;
MarginV: number;
Effect: string;
Text: string;
ReadOrder: number;
Layer: number;
_index: number;
}
interface ASS_Style {
Name: string;
FontName: string;
FontSize: number;
PrimaryColour: number;
SecondaryColour: number;
OutlineColour: number;
BackColour: number;
Bold: number;
Italic: number;
Underline: number;
StrikeOut: number;
ScaleX: number;
ScaleY: number;
Spacing: number;
Angle: number;
BorderStyle: number;
Outline: number;
Shadow: number;
Alignment: number;
MarginL: number;
MarginR: number;
MarginV: number;
Encoding: number;
treat_fontname_as_pattern: number;
Blur: number;
Justify: number;
}
interface JassubOptions {
video?: HTMLVideoElement;
canvas?: HTMLCanvasElement;
blendMode?: 'js' | 'wasm';
asyncRender?: boolean;
offscreenRender?: boolean;
onDemandRender?: boolean;
targetFps?: number;
timeOffset?: number;
debug?: boolean;
prescaleFactor?: number;
prescaleHeightLimit?: number;
maxRenderHeight?: number;
dropAllAnimations?: boolean;
dropAllBlur?: boolean
workerUrl?: string;
wasmUrl?: string;
legacyWasmUrl?: string;
modernWasmUrl?: string;
subUrl?: string;
subContent?: string;
fonts?: string[] | Uint8Array[];
availableFonts?: Record<string, string>;
fallbackFont?: string;
useLocalFonts?: boolean;
libassMemoryLimit?: number;
libassGlyphLimit?: number;
}
type ASS_EventCallback = (error: Error | null, event: ASS_Event[]) => void;
type ASS_StyleCallback = (error: Error | null, event: ASS_Style[]) => void;
export default class JASSUB {
constructor (options: JassubOptions);
resize (width?: number, height?: number, top?: number, left?: number): void;
setVideo (video: HTMLVideoElement): void;
runBenchmark (): void;
setTrackByUrl (url: string): void;
setTrack (content: string): void;
freeTrack (): void;
setIsPaused (isPaused: boolean): void;
setRate (rate: number): void;
setCurrentTime (isPaused?: boolean, currentTime?: number, rate?: number): void;
createEvent (event: ASS_Event): void;
setEvent (event: ASS_Event, index: number): void;
removeEvent (index: number): void;
getEvents (callback: ASS_EventCallback): void;
createStyle (style: ASS_Style): void;
setStyle (style: ASS_Style, index: number): void;
removeStyle (index: number): void;
getStyles (callback: ASS_StyleCallback): void;
addFont (font: string | Uint8Array): void;
sendMessage (target: string, data?: Record<string, unknown>, transferable?: Transferable[]): void;
destroy (err?: string): void;
protected _ctx: CanvasRenderingContext2D;
protected _canvas: HTMLCanvasElement;
}