Class WebvttParserUtil


  • @Deprecated
    public final class WebvttParserUtil
    extends Object
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Utility methods for parsing WebVTT data.
    • Method Detail

      • validateWebvttHeaderLine

        public static void validateWebvttHeaderLine​(ParsableByteArray input)
                                             throws ParserException
        Deprecated.
        Reads and validates the first line of a WebVTT file.
        Parameters:
        input - The input from which the line should be read.
        Throws:
        ParserException - If the line isn't the start of a valid WebVTT file.
      • isWebvttHeaderLine

        public static boolean isWebvttHeaderLine​(ParsableByteArray input)
        Deprecated.
        Returns whether the given input is the first line of a WebVTT file.
        Parameters:
        input - The input from which the line should be read.
      • parseTimestampUs

        public static long parseTimestampUs​(String timestamp)
                                     throws NumberFormatException
        Deprecated.
        Parses a WebVTT timestamp.
        Parameters:
        timestamp - The timestamp string.
        Returns:
        The parsed timestamp in microseconds.
        Throws:
        NumberFormatException - If the timestamp could not be parsed.
      • parsePercentage

        public static float parsePercentage​(String s)
                                     throws NumberFormatException
        Deprecated.
        Parses a percentage string.
        Parameters:
        s - The percentage string.
        Returns:
        The parsed value, where 1.0 represents 100%.
        Throws:
        NumberFormatException - If the percentage could not be parsed.
      • findNextCueHeader

        @Nullable
        public static Matcher findNextCueHeader​(ParsableByteArray input)
        Deprecated.
        Reads lines up to and including the next WebVTT cue header.
        Parameters:
        input - The input from which lines should be read.
        Returns:
        A Matcher for the WebVTT cue header, or null if the end of the input was reached without a cue header being found. In the case that a cue header is found, groups 1, 2 and 3 of the returned matcher contain the start time, end time and settings list.