WebvttCueParser


@UnstableApi
public final class WebvttCueParser


Parser for WebVTT cues. (https://w3c.github.io/webvtt/#cues)

Summary

Constants

static final Pattern

Public constructors

Public methods

static Cue

Create a new Cue containing text and with WebVTT default values.

static @Nullable WebvttCueInfo

Parses the next valid WebVTT cue in a parsable array, including timestamps, settings and text.

Constants

CUE_HEADER_PATTERN

public static final Pattern CUE_HEADER_PATTERN

Public constructors

WebvttCueParser

public WebvttCueParser()

Public methods

newCueForText

@VisibleForTesting(otherwise = 3)
public static Cue newCueForText(CharSequence text)

Create a new Cue containing text and with WebVTT default values.

parseCue

public static @Nullable WebvttCueInfo parseCue(ParsableByteArray webvttData, List<WebvttCssStyle> styles)

Parses the next valid WebVTT cue in a parsable array, including timestamps, settings and text.

Parameters
ParsableByteArray webvttData

Parsable WebVTT file data.

List<WebvttCssStyle> styles

List of styles defined by the CSS style blocks preceding the cues.

Returns
@Nullable WebvttCueInfo

The parsed cue info, or null if no valid cue was found.