From 3425c2f360f11c5d2eb0fe72e29a877e2f198938 Mon Sep 17 00:00:00 2001 From: David Schulte Date: Thu, 13 Jun 2024 21:29:52 +0200 Subject: [PATCH] Updated `libpgs` to add web-worker support for PGS rendering. --- package-lock.json | 31 ++++++--------------------- package.json | 2 +- src/plugins/htmlVideoPlayer/plugin.js | 1 + webpack.common.js | 3 ++- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54b1345a519b..8f39919d9c0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "jquery": "3.7.1", "jstree": "3.3.16", "libarchive.js": "1.3.0", - "libpgs": "0.2.1", + "libpgs": "0.3.1", "lodash-es": "4.17.21", "markdown-it": "14.1.0", "material-design-icons-iconfont": "6.7.0", @@ -136,23 +136,6 @@ "yarn": "YARN NO LONGER USED - use npm instead." } }, - "../libpgs-js": { - "name": "libpgs", - "version": "0.2.1", - "extraneous": true, - "license": "MIT", - "devDependencies": { - "@tsconfig/recommended": "^1.0.6", - "@types/jest": "^29.5.12", - "jest": "^29.7.0", - "ts-jest": "^29.1.4", - "ts-loader": "^9.5.1", - "ts-node": "^10.9.2", - "typescript": "^5.4.5", - "webpack": "^5.91.0", - "webpack-cli": "^5.1.4" - } - }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -13223,9 +13206,9 @@ "integrity": "sha512-EkQfRXt9DhWwj6BnEA2TNpOf4jTnzSTUPGgE+iFxcdNqjktY8GitbDeHnx8qZA0/IukNyyBUR3oQKRdYkO+HFg==" }, "node_modules/libpgs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.2.1.tgz", - "integrity": "sha512-4aYbQZ7UavFTFCmr1uqTJpQWjtbt1mefvjYWJl4nq3uPVWKp5L/GeGrVWPinoNd2fAXAzuMmvjgKwuYaGff2BQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.3.1.tgz", + "integrity": "sha512-vf5t8flM1HcPoP58j2r9wtVW2+PTuRvjbQdoPboWl9jbkmAw/VqpNd13YLx1TNWZ3SYMwlCf8Bze/BmYF/H/dg==", "license": "MIT" }, "node_modules/lie": { @@ -33194,9 +33177,9 @@ "integrity": "sha512-EkQfRXt9DhWwj6BnEA2TNpOf4jTnzSTUPGgE+iFxcdNqjktY8GitbDeHnx8qZA0/IukNyyBUR3oQKRdYkO+HFg==" }, "libpgs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.2.1.tgz", - "integrity": "sha512-4aYbQZ7UavFTFCmr1uqTJpQWjtbt1mefvjYWJl4nq3uPVWKp5L/GeGrVWPinoNd2fAXAzuMmvjgKwuYaGff2BQ==" + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.3.1.tgz", + "integrity": "sha512-vf5t8flM1HcPoP58j2r9wtVW2+PTuRvjbQdoPboWl9jbkmAw/VqpNd13YLx1TNWZ3SYMwlCf8Bze/BmYF/H/dg==" }, "lie": { "version": "3.1.1", diff --git a/package.json b/package.json index 15deb8b45aec..8eefef3ad755 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "jquery": "3.7.1", "jstree": "3.3.16", "libarchive.js": "1.3.0", - "libpgs": "0.2.1", + "libpgs": "0.3.1", "lodash-es": "4.17.21", "markdown-it": "14.1.0", "material-design-icons-iconfont": "6.7.0", diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 52b26e794464..e26b2004c276 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1342,6 +1342,7 @@ export class HtmlVideoPlayer { const options = { video: videoElement, subUrl: getTextTrackUrl(track, item), + workerUrl: `${appRouter.baseUrl()}/libraries/libpgs.worker.js`, timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000 }; this.#currentPgsRenderer = new libpgs.PgsRenderer(options); diff --git a/webpack.common.js b/webpack.common.js index a8ceb61f9198..d998ddcdf280 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -14,7 +14,8 @@ const Assets = [ '@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.js', '@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.wasm', '@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker-legacy.js', - 'pdfjs-dist/build/pdf.worker.js' + 'pdfjs-dist/build/pdf.worker.js', + 'libpgs/dist/libpgs.worker.js' ]; const LibarchiveWasm = [