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