Closed ElectiveRob closed 3 years ago
This code here https://github.com/AlexPoint/SubtitlesParser/blob/febe41daae152e0e8eccfc3bbadf55e3511185ea/SubtitlesParser/Classes/Parsers/VttParser.cs#L171 should parse hour numbers greater than 24 fine. What was the timecode that gave you the -1 error?
file i used to test
WEBVTT
00:01.000 --> 00:04.000
Never drink liquid nitrogen.
00:05.000 --> 00:09.000
— It will perforate your stomach.
— You could die.
23:00:05.000 --> 23:59:59.999
— It will perforate your stomach.
— You could die.
24:00:00.000 --> 55:00:00.000
— It will perforate your stomach.
— You could die.
See that 23:59:59.999
wil be parsed correctly
but 24:00:00.000
wil be -1
TimeSpan.TryParse
doesn't seem to support the notation
https://github.com/AlexPoint/SubtitlesParser/blob/febe41daae152e0e8eccfc3bbadf55e3511185ea/SubtitlesParser/Classes/Parsers/VttParser.cs#L192
This is a good point! I just fixed this behavior and published a new package (1.4.9) to nuget with this fix. That must be one hell of a movie with subtitle items at more than 24 hours though! ;)
Web VTT spec allows to have subtitles after 24 hours. see: https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API#Cue_timings