1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Added time offset support for PGS subtitles.

This commit is contained in:
David Schulte 2024-06-09 21:30:46 +02:00
parent e9aedc3305
commit febc67f04d
3 changed files with 17 additions and 19 deletions

26
package-lock.json generated
View file

@ -45,7 +45,7 @@
"jquery": "3.7.1", "jquery": "3.7.1",
"jstree": "3.3.16", "jstree": "3.3.16",
"libarchive.js": "2.0.2", "libarchive.js": "2.0.2",
"libpgs": "0.2.0", "libpgs": "0.2.1",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"markdown-it": "14.1.0", "markdown-it": "14.1.0",
"material-design-icons-iconfont": "6.7.0", "material-design-icons-iconfont": "6.7.0",
@ -141,7 +141,8 @@
}, },
"../libpgs-js": { "../libpgs-js": {
"name": "libpgs", "name": "libpgs",
"version": "0.2.0", "version": "0.2.1",
"extraneous": true,
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@tsconfig/recommended": "^1.0.6", "@tsconfig/recommended": "^1.0.6",
@ -14989,8 +14990,10 @@
} }
}, },
"node_modules/libpgs": { "node_modules/libpgs": {
"resolved": "../libpgs-js", "version": "0.2.1",
"link": true "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.2.1.tgz",
"integrity": "sha512-4aYbQZ7UavFTFCmr1uqTJpQWjtbt1mefvjYWJl4nq3uPVWKp5L/GeGrVWPinoNd2fAXAzuMmvjgKwuYaGff2BQ==",
"license": "MIT"
}, },
"node_modules/lie": { "node_modules/lie": {
"version": "3.1.1", "version": "3.1.1",
@ -36551,18 +36554,9 @@
} }
}, },
"libpgs": { "libpgs": {
"version": "file:../libpgs-js", "version": "0.2.1",
"requires": { "resolved": "https://registry.npmjs.org/libpgs/-/libpgs-0.2.1.tgz",
"@tsconfig/recommended": "^1.0.6", "integrity": "sha512-4aYbQZ7UavFTFCmr1uqTJpQWjtbt1mefvjYWJl4nq3uPVWKp5L/GeGrVWPinoNd2fAXAzuMmvjgKwuYaGff2BQ=="
"@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"
}
}, },
"lie": { "lie": {
"version": "3.1.1", "version": "3.1.1",

View file

@ -106,6 +106,7 @@
"jquery": "3.7.1", "jquery": "3.7.1",
"jstree": "3.3.16", "jstree": "3.3.16",
"libarchive.js": "2.0.2", "libarchive.js": "2.0.2",
"libpgs": "0.2.1",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"markdown-it": "14.1.0", "markdown-it": "14.1.0",
"material-design-icons-iconfont": "6.7.0", "material-design-icons-iconfont": "6.7.0",
@ -123,8 +124,7 @@
"swiper": "11.1.12", "swiper": "11.1.12",
"usehooks-ts": "3.1.0", "usehooks-ts": "3.1.0",
"webcomponents.js": "0.7.24", "webcomponents.js": "0.7.24",
"whatwg-fetch": "3.6.20", "whatwg-fetch": "3.6.20"
"libpgs": "0.2.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"sass-embedded": "1.77.8" "sass-embedded": "1.77.8"

View file

@ -594,6 +594,9 @@ export class HtmlVideoPlayer {
if (this.#currentAssRenderer) { if (this.#currentAssRenderer) {
this.updateCurrentTrackOffset(offsetValue); this.updateCurrentTrackOffset(offsetValue);
this.#currentAssRenderer.timeOffset = (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000 + offsetValue; this.#currentAssRenderer.timeOffset = (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000 + offsetValue;
} else if (this.#currentPgsRenderer) {
this.updateCurrentTrackOffset(offsetValue);
this.#currentPgsRenderer.timeOffset = (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000 + offsetValue;
} else { } else {
const trackElements = this.getTextTracks(); const trackElements = this.getTextTracks();
// if .vtt currently rendering // if .vtt currently rendering
@ -1333,7 +1336,8 @@ export class HtmlVideoPlayer {
import('libpgs').then((libpgs) => { import('libpgs').then((libpgs) => {
const options = { const options = {
video: videoElement, video: videoElement,
subUrl: getTextTrackUrl(track, item) subUrl: getTextTrackUrl(track, item),
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000
}; };
this.#currentPgsRenderer = new libpgs.PgsRenderer(options); this.#currentPgsRenderer = new libpgs.PgsRenderer(options);
}); });