Skip to content

Commit 9424e8f

Browse files
committedOct 5, 2021
readme: document all render modes
1 parent 6ec2cd1 commit 9424e8f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed
 

‎README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,29 @@ When creating an instance of SubtitleOctopus, you can set the following options:
119119
- `debug`: Whether performance info is printed in the console. (Default:
120120
`false`)
121121

122-
### Fast Render Mode (Lossy) (EXPERIMENTAL)
122+
Additionally there are options to choose between different rendering modes, which are detailed
123+
below. If multiple rendering options are set any of them may be used, they are not additive.
124+
125+
### Rendering Modes
126+
#### Default
127+
Do not set any addiotional rendering option to use this mode.
128+
This will do all the processing of the bitmaps produced by libass outside of WebAssembly.
129+
130+
#### WASM Blending
131+
Upon creating the SubtitleOctopus instance, set `blendRender` in the options to `true` to use this mode.
132+
This will blend the bitmaps of the different events together in WebAssembly, so the
133+
JavaScript-part only needs to process a single image.
134+
If WebAssembly-support is available this will be faster than the default mode,
135+
especially for many and/or complex simultaneous subtitles.
136+
Without WebAssembly-support it will fallback to asm.js and should at least
137+
not be slower than the default mode.
138+
139+
#### Fast Render Mode (Lossy) (EXPERIMENTAL)
140+
Upon creating the SubtitleOctopus instance, set `lossyRender` in the options to `true` to use this mode.
123141
The Fast Render mode has been created by @no1d as a suggestion for fix browser freezing when rendering heavy subtitles (#46), it use [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap) to render the bitmap in the Worker, using Promises instead of direct render on canvas in the Main Thread. When the browser start to hang, it will not lock main thread, instead will run Async, so if the function createImageBitmap fail, it will not stop the rendering process at all and may cause some bitmap loss or simply will not draw anything in canvas, mostly on low end devices.
124142

125143
**WARNING: Experimental, not stable and not working in Safari**
126144

127-
To enable this mode set the option `lossyRender` to `true` when creating an instance of SubtitleOctopus.
128145

129146
### Brotli Compressed Subtitles
130147
The SubtitleOctopus allow the use of compressed subtitles in brotli format, saving bandwidth and reducing library startup time

0 commit comments

Comments
 (0)
Please sign in to comment.