Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard matching VTT definition #10

Open
gmkll opened this issue Aug 5, 2019 · 0 comments
Open

Standard matching VTT definition #10

gmkll opened this issue Aug 5, 2019 · 0 comments

Comments

@gmkll
Copy link

gmkll commented Aug 5, 2019

Although you mention, that you want to comply with JWPlayers VTT definition only, the official one https://www.w3.org/TR/webvtt1/ states, that Web Vtt timing has before and after --> one or more U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters.

You already have a construct, which has an optional whitespace in ( ?--> ?), but this would allow even none space (e.g. 00:00:00.000-->00:00:0, which is not correct/allowed (context is in processVtt function matching vttDef variable:
vttDef.match(/([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?( ?--> ?)([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?[\r\n]{1}.*/gi)).

I suggest changing this part to ( +?--> +?) (+ = one or more - ? becomes non greedy quantifier) or at least fix it by adding one extra optional space ( ?--> ?), that is the regex becomes:
vttDef.match(/([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?( +?--> +?)([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?[\r\n]{1}.*/gi).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant