Fix parsing subtitle timestamps with no hour component #491
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on my own implementation of #486, I discovered that the library already reads in every VTT segment file and should be rendering the subtitles just fine. The only problem with our example is actually that the timestamps aren't being parsed correctly due to a missing hour component (
01:23.456
rather than00:01:23.456
like the plugin currently expects).Since both formats appear to be valid, I went ahead and added some code to interpret a missing hour component as 0 hours.
This small change allows the plugin to correctly render the captions in our example, but we've still yet to test segmented captions in a live stream (constantly-changing manifest).
As an aside, some of our segment VTT files are empty (except for the
WEBVTT
header) and throw (harmless) exceptions within the parsing code. I'm going to submit another PR (#492) that will filter out empty segments and cut down on the thrown/logged exceptions because this kind of file is also valid.