Skip to main content
Helios provides utilities for working with video captions in SRT and WebVTT formats.

CaptionCue

Interface representing a single caption cue.

parseSrt()

Parses SRT (SubRip) format caption files.
string
required
SRT file content as string
CaptionCue[]
Array of parsed caption cues

Example

parseWebVTT()

Parses WebVTT format caption files.
string
required
WebVTT file content as string (must start with “WEBVTT”)
CaptionCue[]
Array of parsed caption cues

Example

parseCaptions()

Automatically detects and parses SRT or WebVTT format.
string
required
Caption file content (SRT or WebVTT)
CaptionCue[]
Array of parsed caption cues

Example

stringifySrt()

Converts caption cues to SRT format.
CaptionCue[]
required
Array of caption cues
string
SRT formatted string

Example

findActiveCues()

Finds caption cues active at a specific time.
CaptionCue[]
required
Array of caption cues
number
required
Time in milliseconds
CaptionCue[]
Array of cues active at the given time

Example

areCuesEqual()

Checks if two cue arrays are equal.
CaptionCue[]
required
First array of cues
CaptionCue[]
required
Second array of cues
boolean
True if arrays contain the same cue objects in the same order

Example

Complete example

Format specifications

SRT format

  • Numeric ID (optional, will be auto-generated)
  • Timecode format: HH:MM:SS,mmm
  • Arrow separator: -->
  • Text can span multiple lines
  • Blocks separated by blank lines

WebVTT format

  • Must start with WEBVTT
  • Timecode format: HH:MM:SS.mmm or MM:SS.mmm
  • Arrow separator: -->
  • Supports cue settings (ignored by parser)
  • NOTE blocks are ignored