Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TheOneric] Deprecate manual brotli decompression #54

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,16 @@ Adjusting `prescaleFactor`, `prescaleHeightLimit` and `maxRenderHeight` to lower
the rendering canvas can work around this at the expense of visual quality.


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

To use, just run: `brotli subFile.ass` and use the .br result file with the subUrl option
### Brotli Compressed Subtitles (DEPRECATED)
Manual support for brotli-compressed subtitles is tentatively deprecated
and may be removed with the next release.

Instead use HTTP's `Content-Encoding:` header to transmit files compressed and
let the browser handle decompression before it reaches JSO. This supports more
compression algorithms and is likely faster.
Do not use a `.br` file extension if you use `Content-Ecoding:` as this will
conflict with the still existing manual support which tries to decompress any data
with a `.br` extension.

## How to build?

Expand Down
8 changes: 7 additions & 1 deletion src/pre-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ function isBrotliFile(url) {
len = url.length;
}

return url.endsWith(".br", len);
if (url.endsWith(".br", len)) {
console.warn("Support for manual brotli decompression is tentatively deprecated and "
+ "may be removed with the next release. Instead use HTTP's Content-Encoding.")
return true;
}

return false;
}

Module = Module || {};
Expand Down