@svta/common-media-library
    Preparing search index...

    Class WebVttParserBeta

    A WebVTT parser.

    const vtt = `WEBVTT\n\nREGION\nid:test\n\nSTYLE\n::cue {}\n\nCUE_1\n00:00:00.000 --> 00:00:35.000\nWevVTT Sample\n`;
    const cues = [] as WebVttCue[];
    const errors = [] as WebVttParsingError[];
    const regions = [] as WebVttRegion[];
    const styles = [] as string[];

    const parser = new WebVttParser();
    parser.oncue = cue => cues.push(cue);
    parser.onparsingerror = error => errors.push(error);
    parser.onregion = region => regions.push(region);
    parser.onstyle = style => styles.push(style);
    parser.parse(vtt);
    parser.flush();

    assert(cues[0].id === 'CUE_1');
    assert(cues[0].text === 'WevVTT Sample');
    assert(errors.length === 0);
    assert(regions[0].id === 'test');
    assert(styles.length === 1);
    Index

    Constructors

    Properties

    oncue?: (cue: WebVttCue) => void

    A callback function that is called when a cue is parsed.

    onflush?: () => void

    A callback function that is called when the parser is flushed.

    onparsingerror?: (error: WebVttParsingError) => void

    A callback function that is called when a parsing error occurs.

    onregion?: (region: WebVttRegion) => void

    A callback function that is called when a region is parsed.

    onstyle?: (style: string) => void

    A callback function that is called when a style is parsed.

    ontimestampmap?: (timestampMap: TimestampMap) => void

    A callback function that is called when a timestamp map is parsed.

    Methods