Closed nakkamarra closed 3 weeks ago
Actually, now that I look through what the webvtt reader is doing and think about it, this could just be done by directly by calculating the offset and then manually applying it i.e subtitles.Add(calculatedOffset)
🤔
Actually I believe this needs to be reworked either way.
@anupcshan @asticode I don't believe we can always just apply the timeOffset from the X-TIMESTAMP-MAP
like we are doing here, because if we want to be able to support writing the X-TIMESTAMP-MAP
or manually applying the offset defined by it like my comment above suggests, we would have to consider the case that the current *Subtitles
have been parsed from a WebVTT and the correction has already been applied. In this scenario we will have cue times that have been shifted by the offset, plus a header or Add(...)
call applying the same offset again resulting in 2x the offset.
Here's an example of the usage in a PR I've created, the usage still supports both cases I think, but in @anupcshan 's case where you want to write a WebVTT without the header and the time offset applied, you can do so with a call to Add()
Sorry for the annoying bump @asticode @anupcshan but any thoughts on this issue / PR?
No worries, I have seen your PR but didn't have much time to review it. I'll try to do it next week 👍
I'd like to be able to set an
X-TIMESTAMP-MAP
before writing to WebVTT. Maybe could store it onMetadata
as a struct? i.e