Back to Exoplayer

WebvttParserUtil (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/text/webvtt/WebvttParserUtil.html

latest4.8 KB
Original Source

Package com.google.android.exoplayer2.text.webvtt

Class WebvttParserUtil


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classWebvttParserUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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 Summary

All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static Matcher | findNextCueHeader​(ParsableByteArray input) | Deprecated.

Reads lines up to and including the next WebVTT cue header. | | static boolean | isWebvttHeaderLine​(ParsableByteArray input) | Deprecated.

Returns whether the given input is the first line of a WebVTT file. | | static float | parsePercentage​(String s) | Deprecated.

Parses a percentage string. | | static long | parseTimestampUs​(String timestamp) | Deprecated.

Parses a WebVTT timestamp. | | static void | validateWebvttHeaderLine​(ParsableByteArray input) | Deprecated.

Reads and validates the first line of a WebVTT file. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

- 

validateWebvttHeaderLine

public static void validateWebvttHeaderLine​([ParsableByteArray](../../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")input)
                                     throws[ParserException](../../ParserException.html "class in com.google.android.exoplayer2")

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](../../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")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](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")timestamp)
                             throws[NumberFormatException](https://developer.android.com/reference/java/lang/NumberFormatException.html "class or interface in java.lang")

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](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")s)
                             throws[NumberFormatException](https://developer.android.com/reference/java/lang/NumberFormatException.html "class or interface in java.lang")

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](https://developer.android.com/reference/java/util/regex/Matcher.html "class or interface in java.util.regex")findNextCueHeader​([ParsableByteArray](../../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")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.