Skip to content

WebVTT parser returns error if voice tag is on line by itself  #348

@terrill

Description

@terrill

Given these examples:

Example 1

00:11.000 --> 00:13.000
<v Roger Bingham> We are in New York City

Example 2

00:11.000 --> 00:13.000
<v Roger Bingham> 
We are in New York City

The first is ok, but the second returns an "Invalid WebVTT file" error via webvtt.js > parseCue(). In the example, the value of nextLine is expected to be a timestamp but it's a string ("We are in New York City"), which triggers the error.

All of the examples of voice tags in the WebVTT spec have the voice tag followed by text on the same line, and this arrangement makes sense. However, the spec doesn't seem to require text on the same line as a voice tag, and the above is valid according to the Live WebVTT Validator.

Having the voice tag on a line by itself might in fact be common since the DCMP Captioning Key calls for speaker identification to be on a line by itself, wrapped in parentheses. Caption files created in other formats that conform to the Captioning Key recommendations might be converted into WebVTT with a simple search/replace, resulting in a voice tag on a line by itself.

I'm not having any luck figuring out where within the parser things are going awry, so if anyone can figure it out, please send a pull request!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions