diff --git a/src/remux/mp4-remuxer.ts b/src/remux/mp4-remuxer.ts index 99e17f2fa8a..37243960429 100644 --- a/src/remux/mp4-remuxer.ts +++ b/src/remux/mp4-remuxer.ts @@ -1110,7 +1110,7 @@ export function flushTextTrackUserdataCueSamples( // using this._initPTS and this._initDTS to calculate relative time sample.pts = normalizePts( - sample.pts - (initPTS.baseTime * 90000) / initPTS.timescale, + sample.pts - (initPTS.baseTime * inputTimeScale) / initPTS.timescale, timeOffset * inputTimeScale ) / inputTimeScale; } diff --git a/src/utils/texttrack-utils.ts b/src/utils/texttrack-utils.ts index dd64a9cc68c..1f8a944ea74 100644 --- a/src/utils/texttrack-utils.ts +++ b/src/utils/texttrack-utils.ts @@ -29,13 +29,19 @@ export function addCueToTrack(track: TextTrack, cue: VTTCue) { } } catch (err) { logger.debug(`[texttrack-utils]: ${err}`); - const textTrackCue = new (self.TextTrackCue as any)( - cue.startTime, - cue.endTime, - cue.text - ); - textTrackCue.id = cue.id; - track.addCue(textTrackCue); + try { + const textTrackCue = new (self.TextTrackCue as any)( + cue.startTime, + cue.endTime, + cue.text + ); + textTrackCue.id = cue.id; + track.addCue(textTrackCue); + } catch (err2) { + logger.debug( + `[texttrack-utils]: Legacy TextTrackCue fallback failed: ${err2}` + ); + } } } if (mode === 'disabled') {