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

CR delimited VTT files not supported #64

Open
mlitwin opened this issue Jul 18, 2023 · 2 comments
Open

CR delimited VTT files not supported #64

mlitwin opened this issue Jul 18, 2023 · 2 comments

Comments

@mlitwin
Copy link

mlitwin commented Jul 18, 2023

VTT files with carriage return (CR \r) line endings are rejected by the parser with a ParsingError.Errors.BadSignature error.

Issue seems to be the regex at

if (!/\r\n|\n/.test(self.buffer)) {
not handling the \r case, resulting in downstream rejection because it seems like there's only one line in the vtt.

Per https://www.w3.org/TR/webvtt1/#webvtt-line-terminator "A single U+000D CARRIAGE RETURN (CR) character." should be supported.

Other notes:

@mister-ben
Copy link

We would need to make sure \r\n can never be interpreted as two line breaks which wuld also break parsing.

@mlitwin
Copy link
Author

mlitwin commented Jul 28, 2023

Yeah - thought the https://github.com/videojs/vtt.js/blob/2eb1ea469f06478cd40268fe9d7de5746dee60fb/lib/parser/parser.js#L45C12-L45C27 collectNextLine() function seems like it already handles that case. There's another regex at

if (!/\r\n|\n/.test(self.buffer)) {
that looks like it needs an \r test.

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

2 participants