Skip to content

Bug: Subtitle playlists with multiple .vtt files are not loaded properly #160

@patriciomartino-qualabs

Description

When attempting to play an asset which contains a subtitles playlist that references multiple .vtt files (Example at the bottom) the subtitles are not properly fetched, and the following error is thrown:
Cue identifier needs to be followed by timestamp (cue #0)

In the node-webvtt package, this is the line that throws the error:

 if (lines.length > 1 &&
      !(lines[0].includes('-->') || lines[1].includes('-->'))) {
    const msg = `Cue identifier needs to be followed by timestamp (cue #${i})`;
    throw new ParserError(msg);
  }

When playing the asset on an hls.js player that does not use node-webvtt, the issue is not encountered and the subtitles are successfully rendered.

Example subtitle playlist to reproduce the error:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:9999
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:9999.000,
extracted_subtitles/subtitle_0.vtt
#EXTINF:9999.000,
extracted_subtitles/subtitle_1.vtt
#EXT-X-ENDLIST

Example subtitle playlist that works properly:

#EXTM3U
#EXT-X-TARGETDURATION:98
#EXT-X-VERSION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:98.43200,	
#EXT-X-BYTERANGE:265@0
main.webvtt
#EXT-X-ENDLIST

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions