Skip to content

Commit

Permalink
Merge pull request #54 from dmitrylyzo/deprecate-brotli
Browse files Browse the repository at this point in the history
[TheOneric] Deprecate manual brotli decompression
  • Loading branch information
dmitrylyzo committed Mar 22, 2024
2 parents f373e10 + bde0b95 commit bb32b39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
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

0 comments on commit bb32b39

Please sign in to comment.