jassub 1.8.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,250 +2,111 @@
2
2
  JASSUB
3
3
  </h1>
4
4
  <p align="center">
5
- JavaScript SSA/ASS Subtitle Renderer.
6
- </p>
7
- JASSUB is a JS wrapper for <a href="https://github.com/libass/libass">libass</a>, which renders <a href="https://en.wikipedia.org/wiki/SubStation_Alpha">SSA/ASS subtitles</a> directly in your browser. It uses Emscripten to compile libass' C++ code to WASM.
8
-
9
- <p align="center">
10
- <a href="https://thaunknown.github.io/jassub/">Online Demos</a>
5
+ JavaScript SSA/ASS Subtitle Renderer For Modern Browsers.
11
6
  </p>
7
+ JASSUB is a JS wrapper for <a href="https://github.com/libass/libass">libass</a>, which renders <a href="https://en.wikipedia.org/wiki/SubStation_Alpha">SSA/ASS subtitles</a> directly in your browser. It uses Emscripten to compile libass' C++ code to WASM, and WebGPU for hardware acceleration.
12
8
 
13
9
  ## Features
14
- - Supports most SSA/ASS features (everything libass supports)
15
- - Supports all OpenType, TrueType and WOFF fonts, as well as embedded fonts
16
- - Supports anamorphic videos [(on browsers which support it)](https://caniuse.com/mdn-api_htmlvideoelement_requestvideoframecallback)
17
- - Supports different video color spaces [(on browsers which support it)](https://caniuse.com/mdn-api_videocolorspace)
18
- - Capable of using local fonts [(on browsers which support it)](https://caniuse.com/mdn-api_window_querylocalfonts)
19
- - Works fast (all the heavy lifting is done by WebAssembly)
20
- - Is fully threaded (on browsers which support it, it's capable of working fully on a separate thread)
21
- - Is asynchronous (renders when available, not in order of execution)
22
- - Benefits from hardware acceleration (uses hardware accelerated canvas API's)
23
- - Doesn't manipulate the DOM to render subtitles
24
- - Easy to use - just connect it to video element
25
-
26
- ## Isn't this just the same thing as JavascriptSubtitlesOctopus?
27
- No. See <a href="https://thaunknown.github.io/jassub/explainer.html">this</a> comparison.
10
+
11
+ * Supports all SSA/ASS features (everything libass supports)
12
+ * Supports all OpenType, TrueType and WOFF fonts, as well as embedded fonts
13
+ * Supports anamorphic videos [(on browsers which support it)](https://caniuse.com/mdn-api_htmlvideoelement_requestvideoframecallback)
14
+ * Supports color space mangling [(on browsers which support it)](https://caniuse.com/mdn-api_videocolorspace)
15
+ * Capable of using local fonts [(on browsers which support it)](https://caniuse.com/mdn-api_window_querylocalfonts)
16
+ * Works fast (all the heavy lifting is done by WebAssembly and WebGPU, with absolutely minimal JS glue)
17
+ * Is fully multi-threaded
18
+ * Is asynchronous (renders when available, not in order of execution)
19
+ * Benefits from hardware acceleration (uses WebGPU)
20
+ * Doesn't manipulate the DOM to render subtitles
21
+ * Easy to use - just connect it to video element
28
22
 
29
23
  ## Usage
30
- By default all you need to do is copy the files from the `dist/` folder of the repository into the same folder as where your JS runs, then do:
24
+
25
+ ```shell
26
+ [p]npm i jassub
27
+ ```
28
+
31
29
  ```js
32
- import JASSUB from './jassub.es.js'
30
+ import JASSUB from 'jassub'
33
31
 
34
- const renderer = new JASSUB({
32
+ const instance = new JASSUB({
35
33
  video: document.querySelector('video'),
36
34
  subUrl: './tracks/sub.ass'
37
35
  })
38
36
  ```
39
- `Note:` while the `dist/` folder includes a UMD dist it still uses modern syntax. If you want backwards compatibility with older browsers I recommend you run it tru babel.
40
37
 
41
- If you use a bundler like Vite, you can instead do:
42
- ```shell
43
- npm i jassub
44
- ```
38
+ If you use a custom bundler, and need to override the worker and wasm URLs you can instead do:
45
39
 
46
40
  ```js
47
41
  import JASSUB from 'jassub'
48
42
  import workerUrl from 'jassub/dist/jassub-worker.js?url'
49
- import wasmUrl from 'jassub/dist/jassub-worker.wasm?url'
43
+ import wasmUrl from 'jassub/dist/jassub-worker.wasm?url' // non-SIMD fallback
44
+ import modernWasmUrl from 'jassub/dist/jassub-worker-modern.wasm?url' // SIMD
50
45
 
51
- const renderer = new JASSUB({
46
+ const instance = new JASSUB({
52
47
  video: document.querySelector('video'),
53
48
  subContent: subtitleString,
54
- workerUrl, // you can also use: `new URL('jassub/dist/jassub-worker.js', import.meta.url)` instead of importing it as an url
55
- wasmUrl
49
+ workerUrl, // you can also use: `new URL('jassub/dist/jassub-worker.js', import.meta.url)` instead of importing it as an url, or whatever solution suits you
50
+ wasmUrl,
51
+ modernWasmUrl
56
52
  })
57
53
  ```
54
+
55
+ However this shoud almost never be necessary.
56
+
58
57
  ## Using only with canvas
58
+
59
59
  You're also able to use it without any video. However, that requires you to set the time the subtitles should render at yourself:
60
+
60
61
  ```js
61
62
  import JASSUB from './jassub.es.js'
62
63
 
63
- const renderer = new JASSUB({
64
+ const instance = new JASSUB({
64
65
  canvas: document.querySelector('canvas'),
65
66
  subUrl: './tracks/sub.ass'
66
67
  })
67
68
 
68
- renderer.setCurrentTime(15)
69
+ await instance.ready
70
+
71
+ instance.setCurrentTime(15)
69
72
  ```
70
- ## Changing subtitles
71
- You're not limited to only display the subtitle file you referenced in your options. You're able to dynamically change subtitles on the fly. There's three methods that you can use for this specifically:
72
73
 
73
- - `setTrackByUrl(url):` works the same as the `subUrl` option. It will set the subtitle to display by its URL.
74
- - `setTrack(content):` works the same as the `subContent` option. It will set the subtitle to dispaly by its content.
75
- - `freeTrack():` this simply removes the subtitles. You can use the two methods above to set a new subtitle file to be displayed.
76
- ```js
77
- renderer.setTrackByUrl('/newsub.ass')
74
+ # Docs
75
+
76
+ The library is fully typed, so you can simply browse the types of `instance` or `instance.renderer`. "Private" fields are prefixed with `_` such as `_fontId` or `_findAvailableFonts`, and shouldn't be used by developers, but can if the need arises.
77
+
78
+ `instance.renderer` calls are ALWAYS async as it's a remote worker, which means you should always await/then them for the IPC call to be serialized!!! For example:
79
+
80
+ ```ts
81
+ const x = instance.renderer.useLocalFonts // does nothing, returns IPC proxy object
82
+ const y = await instance.renderer.useLocalFonts // returns true/false
83
+
84
+ instance.renderer.useLocalFonts = false // this is fine
85
+ await (instance.renderer.useLocalFonts = false) // or u can await it for safety
86
+
87
+ instance.renderer.setDefaultFont('Gandhi Sans') // this is fine, sets default font
88
+ await instance.renderer.setDefaultFont('Gandhi Sans') // or you can await if if you want
78
89
  ```
79
- ## Cleaning up the object
80
- After you're finished with rendering the subtitles. You need to call the `destroy()` method to correctly destroy the object.
81
- ```js
82
- const renderer = new JASSUB(options)
83
- // After you've finished using it...
84
- renderer.destroy()
90
+
91
+ Make sure to always `await instance.ready` before running any methods!!!
92
+
93
+ ## Looking for backwards compatibility with older browser engines?
94
+
95
+ Please check the [v1.8.8 tag](https://github.com/ThaUnknown/jassub/releases/tag/1.8.8), or install it via:
96
+
97
+ ```shell
98
+ [p]npm i jassub@1.8.8
85
99
  ```
86
- ## Options
87
- The default options are best, and automatically fallback to the next fastest options in line, when the API's they use are unsupported. You can however forcefully change this behavior by specifying options. These options are included in the JSDoc of the object, so if your editor supports JSDoc IntelliSense you will see these exact descriptions when calling methods and specifying options.
88
-
89
- - `{Object} options` Settings object.
90
- - `{HTMLVideoElement} options.video` Video to use as target for rendering and event listeners. Optional if canvas is specified instead.
91
- - `{HTMLCanvasElement} options.canvas` { Optional } Canvas to use for manual handling. Not required if video is specified.
92
- - `{'js'|'wasm'} options.blendMode` { Optional = 'js' } Which image blending mode to use. WASM will perform better on lower end devices, JS will perform better if the device and browser supports hardware acceleration.
93
- - `{Boolean} options.asyncRender` { Optional = true } Whether or not to use async rendering, which offloads the CPU by creating image bitmaps on the GPU.
94
- - `{Boolean} options.offscreenRender` { Optional = true } Whether or not to render things fully on the worker, greatly reduces CPU usage.
95
- - `{Boolean} options.onDemandRender` { Optional = true } Whether or not to render subtitles as the video player renders frames, rather than predicting which frame the player is on using events.
96
- - `{Number} options.targetFps` { Optional = true } Target FPS to render subtitles at. Ignored when onDemandRender is enabled.
97
- - `{Number} options.timeOffset` { Optional = 0 } Subtitle time offset in seconds.
98
- - `{Boolean} options.debug` { Optional = false } Whether or not to print debug information.
99
- - `{Number} options.prescaleFactor` { Optional = 1.0 } Scale down (< 1.0) the subtitles canvas to improve performance at the expense of quality, or scale it up (> 1.0).
100
- - `{Number} options.prescaleHeightLimit` { Optional = 1080 } The height in pixels beyond which the subtitles canvas won't be prescaled.
101
- - `{Number} options.maxRenderHeight` { Optional = 0 } The maximum rendering height in pixels of the subtitles canvas. Beyond this subtitles will be upscaled by the browser.
102
- - `{Boolean} options.dropAllAnimations` { Optional = false } Attempt to discard all animated tags. Enabling this may severly mangle complex subtitles and should only be considered as an last ditch effort of uncertain success for hardware otherwise incapable of displaing anything. Will not reliably work with manually edited or allocated events.
103
- - `{Boolean} options.dropAllBlur` { Optional = false } The holy grail of performance gains. If heavy TS lags a lot, disabling this will make it ~x10 faster. This drops blur from all added subtitle tracks making most text and backgrounds look sharper, this is way less intrusive than dropping all animations, while still offering major performance gains.
104
- - `{String} options.workerUrl` { Optional = 'jassub-worker.js' } The URL of the worker.
105
- - `{String} options.wasmUrl` { Optional = 'jassub-worker.wasm' } The URL of the worker WASM.
106
- - `{String} options.legacyWasmUrl` { Optional = 'jassub-worker.wasm.js' } The URL of the legacy worker WASM. Only loaded if the browser doesn't support WASM.
107
- - `{String} options.modernWasmUrl` { Optional } The URL of the modern worker WASM. This includes faster ASM instructions, but is only supported by newer browsers, disabled if the URL isn't defined.
108
- - `{String} [options.subUrl=options.subContent]` The URL of the subtitle file to play.
109
- - `{String} [options.subContent=options.subUrl]` The content of the subtitle file to play.
110
- - `{String[]|Uint8Array[]} options.fonts` { Optional } An array of links or Uint8Arrays to the fonts used in the subtitle. If Uint8Array is used the array is copied, not referenced. This forces all the fonts in this array to be loaded by the renderer, regardless of if they are used.
111
- - `{Object} options.availableFonts` { Optional = {'liberation sans': './default.woff2'}} Object with all available fonts - Key is font family in lower case, value is link or Uint8Array: { arial: '/font1.ttf' }. These fonts are selectively loaded if detected as used in the current subtitle track.
112
- - `{String} options.fallbackFont` { Optional = 'liberation sans' } The font family key of the fallback font in availableFonts to use if the other font for the style is missing special glyphs or unicode.
113
- - `{Boolean} options.useLocalFonts` { Optional = false } If the Local Font Access API is enabled [chrome://flags/#font-access], the library will query for permissions to use local fonts and use them if any are missing. The permission can be queried beforehand using navigator.permissions.request({ name: 'local-fonts' }).
114
- - `{Number} options.libassMemoryLimit` { Optional } libass bitmap cache memory limit in MiB (approximate).
115
- - `{Number} options.libassGlyphLimit` { Optional } libass glyph cache memory limit in MiB (approximate).
116
-
117
- ## Methods and properties
118
- This library has a lot of methods and properties, however many aren't made for manual use or have no effect when changing, those are usually prefixed with `_`. Most of these never need to be called by the user.
119
-
120
- ### List of properties:
121
- - `debug` - -||-
122
- - `prescaleFactor` - -||-
123
- - `prescaleHeightLimit` - -||-
124
- - `maxRenderHeight` - -||-
125
- - `busy` - Boolean which specifies if the renderer is currently busy.
126
- - `timeOffset` - -||-
127
- ### List of methods:
128
- - `resize(width = 0, height = 0, top = 0, left = 0, force)` - Resize the canvas to given parameters. Auto-generated if values are ommited.
129
- - {Number} [width=0]
130
- - {Number} [height=0]
131
- - {Number} [top=0]
132
- - {Number} [left=0]
133
- - {Boolean} force
134
- - `setVideo(video)` - Change the video to use as target for event listeners.
135
- - {HTMLVideoElement} video
136
- - `setTrackByUrl(url)` - Overwrites the current subtitle content.
137
- - {String} url URL to load subtitles from.
138
- - `setTrack(content)` - Overwrites the current subtitle content.
139
- - {String} content Content of the ASS file.
140
- - `freeTrack()` - Free currently used subtitle track.
141
- - `setIsPaused(isPaused)` - Sets the playback state of the media.
142
- - {Boolean} isPaused Pause/Play subtitle playback.
143
- - `setRate(rate)` - Sets the playback rate of the media [speed multiplier].
144
- - {Number} rate Playback rate.
145
- - `setCurrentTime(isPaused, currentTime, rate)` - Sets the current time, playback state and rate of the subtitles.
146
- - {Boolean} [isPaused] Pause/Play subtitle playback.
147
- - {Number} [currentTime] Time in seconds.
148
- - {Number} [rate] Playback rate.
149
- - `destroy(err)` - Destroy the object, worker, listeners and all data.
150
- - {String} [err] Error to throw when destroying.
151
- - `sendMessage(target, data = {}, transferable)` - Send data and execute function in the worker.
152
- - {String} target Target function.
153
- - {Object} [data] Data for function.
154
- - {Transferable[]} [transferable] Array of transferables.
155
- - `createEvent(event)` - Create a new ASS event directly.
156
- - {ASS_Event} event
157
- - `setEvent(event, index)` - Overwrite the data of the event with the specified index.
158
- - {ASS_Event} event
159
- - {Number} index
160
- - `removeEvent(index)` - Remove the event with the specified index.
161
- - {Number} index
162
- - `getEvents(callback)` - Get all ASS events.
163
- - {function(Error|null, ASS_Event)} callback Function to callback when worker returns the events.
164
- - `createStyle(style)` - Create a new ASS style directly.
165
- - {ASS_Style} event
166
- - `setStyle (event, index)` - Overwrite the data of the style with the specified index.
167
- - {ASS_Style} event
168
- - {Number} index
169
- - `removeStyle (index)` - Remove the style with the specified index.
170
- - {Number} index
171
- - `getStyles (callback)` - Get all ASS styles.
172
- - {function(Error|null, ASS_Style)} callback Function to callback when worker returns the styles.
173
- - `addfont (font)` - Adds a font to the renderer.
174
- - {String|Uint8Array} font Font to add.
175
-
176
- ### ASS_Event object properties
177
- - `{Number} Start` - Start Time of the Event, in 0:00:00:00 format ie. Hrs:Mins:Secs:hundredths. This is the time elapsed during script playback at which the text will appear onscreen. Note that there is a single digit for the hours!
178
- - `{Number} Duration` - End Time of the Event, in 0:00:00:00 format ie. Hrs:Mins:Secs:hundredths. This is the time elapsed during script playback at which the text will disappear offscreen. Note that there is a single digit for the hours!
179
- - `{String} Style` - Style name. If it is "Default", then your own *Default style will be subtituted.
180
- - `{String} Name` - Character name. This is the name of the character who speaks the dialogue. It is for information only, to make the script is easier to follow when editing/timing.
181
- - `{Number} MarginL` - 4-figure Left Margin override. The values are in pixels. All zeroes means the default margins defined by the style are used.
182
- - `{Number} MarginR` - 4-figure Right Margin override. The values are in pixels. All zeroes means the default margins defined by the style are used.
183
- - `{Number} MarginV` - 4-figure Bottom Margin override. The values are in pixels. All zeroes means the default margins defined by the style are used.
184
- - `{String} Effect` - Transition Effect. This is either empty, or contains information for one of the three transition effects implemented in SSA v4.x
185
- - `{String} Text` - Subtitle Text. This is the actual text which will be displayed as a subtitle onscreen. Everything after the 9th comma is treated as the subtitle text, so it can include commas.
186
- - `{Number} ReadOrder` - Number in order of which to read this event.
187
- - `{Number} Layer` - Z-index overlap in which to render this event.
188
- - `{Number} _index` - (Internal) index of the event.
189
-
190
- ### ASS_Style object properties
191
- - `{String} Name` The name of the Style. Case sensitive. Cannot include commas.
192
- - `{String} FontName` The fontname as used by Windows. Case-sensitive.
193
- - `{Number} FontSize` Font size.
194
- - `{Number} PrimaryColour` A long integer BGR (blue-green-red) value. ie. the byte order in the hexadecimal equivelent of this number is BBGGRR
195
- - `{Number} SecondaryColour` A long integer BGR (blue-green-red) value. ie. the byte order in the hexadecimal equivelent of this number is BBGGRR
196
- - `{Number} OutlineColour` A long integer BGR (blue-green-red) value. ie. the byte order in the hexadecimal equivelent of this number is BBGGRR
197
- - `{Number} BackColour` This is the colour of the subtitle outline or shadow, if these are used. A long integer BGR (blue-green-red) value. ie. the byte order in the hexadecimal equivelent of this number is BBGGRR.
198
- - `{Number} Bold` This defines whether text is bold (true) or not (false). -1 is True, 0 is False. This is independant of the Italic attribute - you can have have text which is both bold and italic.
199
- - `{Number} Italic` Italic. This defines whether text is italic (true) or not (false). -1 is True, 0 is False. This is independant of the bold attribute - you can have have text which is both bold and italic.
200
- - `{Number} Underline` -1 or 0
201
- - `{Number} StrikeOut` -1 or 0
202
- - `{Number} ScaleX` Modifies the width of the font. [percent]
203
- - `{Number} ScaleY` Modifies the height of the font. [percent]
204
- - `{Number} Spacing` Extra space between characters. [pixels]
205
- - `{Number} Angle` The origin of the rotation is defined by the alignment. Can be a floating point number. [degrees]
206
- - `{Number} BorderStyle` 1=Outline + drop shadow, 3=Opaque box
207
- - `{Number} Outline` If BorderStyle is 1, then this specifies the width of the outline around the text, in pixels. Values may be 0, 1, 2, 3 or 4.
208
- - `{Number} Shadow` If BorderStyle is 1, then this specifies the depth of the drop shadow behind the text, in pixels. Values may be 0, 1, 2, 3 or 4. Drop shadow is always used in addition to an outline - SSA will force an outline of 1 pixel if no outline width is given.
209
- - `{Number} Alignment` This sets how text is "justified" within the Left/Right onscreen margins, and also the vertical placing. Values may be 1=Left, 2=Centered, 3=Right. Add 4 to the value for a "Toptitle". Add 8 to the value for a "Midtitle". eg. 5 = left-justified toptitle
210
- - `{Number} MarginL` This defines the Left Margin in pixels. It is the distance from the left-hand edge of the screen.The three onscreen margins (MarginL, MarginR, MarginV) define areas in which the subtitle text will be displayed.
211
- - `{Number} MarginR` This defines the Right Margin in pixels. It is the distance from the right-hand edge of the screen. The three onscreen margins (MarginL, MarginR, MarginV) define areas in which the subtitle text will be displayed.
212
- - `{Number} MarginV` This defines the vertical Left Margin in pixels. For a subtitle, it is the distance from the bottom of the screen. For a toptitle, it is the distance from the top of the screen. For a midtitle, the value is ignored - the text will be vertically centred.
213
- - `{Number} Encoding` This specifies the font character set or encoding and on multi-lingual Windows installations it provides access to characters used in multiple than one languages. It is usually 0 (zero) for English (Western, ANSI) Windows.
214
- - `{Number} treat_fontname_as_pattern`
215
- - `{Number} Blur`
216
- - `{Number} Justify`
100
+
101
+ Support for older browsers (without WebGPU, WebAssembly threads, etc) has been dropped in v2.0.0 and later.
217
102
 
218
103
  # How to build?
219
- ## Dependencies
220
- - git
221
- - emscripten (Configure the enviroment)
222
- - make
223
- - python3
224
- - cmake
225
- - pkgconfig
226
- - patch
227
- - libtool
228
- - autotools (autoconf, automake, autopoint)
229
- - gettext
230
- - ragel - Required by Harfbuzz
231
- - itstool - Required by Fontconfig
232
- - gperf - Required by Fontconfig
233
- - licensecheck
234
104
 
235
105
  ## Get the Source
106
+
236
107
  Run git clone --recursive https://github.com/ThaUnknown/jassub.git
237
108
 
238
- ## Build inside a Container
239
109
  ### Docker
110
+
240
111
  1. Install Docker
241
- 2. ./run-docker-build.sh
242
- 3. Artifacts are in /dist/js
243
- ### Buildah
244
- 1. Install Buildah and a suitable backend for buildah run like crun or runc
245
- 2. ./run-buildah-build.sh
246
- 3. Artifacts are in /dist/js
247
- ## Build without Containers
248
- 1. Install the dependency packages listed above
249
- 2. make
250
- - If on macOS with libtool from brew, LIBTOOLIZE=glibtoolize make
251
- 3. Artifacts are in /dist/js
112
+ 2. ./run-docker-build.sh or ./run-docker-build.ps1
@@ -0,0 +1,71 @@
1
+ import 'rvfc-polyfill';
2
+ import type { ASSRenderer } from './worker/worker';
3
+ import type { Remote } from 'abslink';
4
+ export type JASSUBOptions = {
5
+ timeOffset?: number;
6
+ debug?: boolean;
7
+ prescaleFactor?: number;
8
+ prescaleHeightLimit?: number;
9
+ maxRenderHeight?: number;
10
+ workerUrl?: string;
11
+ wasmUrl?: string;
12
+ modernWasmUrl?: string;
13
+ subUrl?: string;
14
+ subContent?: string;
15
+ fonts?: string[] | Uint8Array[];
16
+ availableFonts?: Record<string, Uint8Array | string>;
17
+ fallbackFont?: string;
18
+ useLocalFonts?: boolean;
19
+ libassMemoryLimit?: number;
20
+ libassGlyphLimit?: number;
21
+ } & ({
22
+ video: HTMLVideoElement;
23
+ canvas?: HTMLCanvasElement;
24
+ } | {
25
+ video?: HTMLVideoElement;
26
+ canvas: HTMLCanvasElement;
27
+ });
28
+ export default class JASSUB {
29
+ timeOffset: number;
30
+ prescaleFactor: number;
31
+ prescaleHeightLimit: number;
32
+ maxRenderHeight: number;
33
+ debug: boolean;
34
+ renderer: Remote<ASSRenderer>;
35
+ ready: Promise<void>;
36
+ busy: boolean;
37
+ _video: HTMLVideoElement | undefined;
38
+ _videoWidth: number;
39
+ _videoHeight: number;
40
+ _videoColorSpace: string | null;
41
+ _canvas: HTMLCanvasElement;
42
+ _canvasParent: HTMLDivElement | undefined;
43
+ _ctrl: AbortController;
44
+ _ro: ResizeObserver;
45
+ _destroyed: boolean;
46
+ _lastDemandTime: VideoFrameCallbackMetadata;
47
+ _skipped: boolean;
48
+ _worker: Worker;
49
+ constructor(opts: JASSUBOptions);
50
+ static _supportsSIMD?: boolean;
51
+ static _test(): void;
52
+ resize(force?: boolean, width?: number, height?: number, top?: number, left?: number): Promise<void>;
53
+ _getVideoPosition(width?: number, height?: number): {
54
+ width: number;
55
+ height: number;
56
+ x: number;
57
+ y: number;
58
+ };
59
+ _computeCanvasSize(width?: number, height?: number): {
60
+ width: number;
61
+ height: number;
62
+ };
63
+ setVideo(video: HTMLVideoElement): Promise<void>;
64
+ _sendLocalFont(name: string): Promise<void>;
65
+ _getLocalFont(font: string): Promise<void>;
66
+ _handleRVFC(data: VideoFrameCallbackMetadata): void;
67
+ _demandRender(): Promise<void>;
68
+ _updateColorSpace(): Promise<void>;
69
+ _removeListeners(): void;
70
+ destroy(): Promise<void>;
71
+ }