ThrowingSubtitleParserFactory


@UnstableApi
class ThrowingSubtitleParserFactory : SubtitleParser.Factory


A SubtitleParser.Factory for SubtitleParser instances that throw an exception on every call to parse.

It claims support for all subtitle formats (returns the result of isText from supportsFormat).

Summary

Public constructors

Public functions

SubtitleParser!
create(format: Format!)

Creates a SubtitleParser for the given Format.

Int

Returns the CueReplacementBehavior of the SubtitleParser implementation that handles format.

Boolean

Returns whether the factory is able to instantiate a SubtitleParser for the given Format.

Inherited Constants

From androidx.media3.extractor.text.SubtitleParser.Factory
const SubtitleParser.Factory!

A subtitle parser factory that supports no formats.

Constants

REPLACEMENT_BEHAVIOR

@Format.CueReplacementBehavior
const val REPLACEMENT_BEHAVIOR = 2: Int

Public constructors

ThrowingSubtitleParserFactory

ThrowingSubtitleParserFactory(
    exceptionSupplier: Supplier<RuntimeException!>!
)

Public functions

create

fun create(format: Format!): SubtitleParser!

Creates a SubtitleParser for the given Format.

Returns
SubtitleParser!

The SubtitleParser instance.

Throws
java.lang.IllegalArgumentException

if format is not supported by this factory.

getCueReplacementBehavior

@Format.CueReplacementBehavior
fun getCueReplacementBehavior(format: Format!): Int

Returns the CueReplacementBehavior of the SubtitleParser implementation that handles format.

Returns
Int

The replacement behavior.

Throws
java.lang.IllegalArgumentException

if format is not supported by this factory.

supportsFormat

fun supportsFormat(format: Format!): Boolean

Returns whether the factory is able to instantiate a SubtitleParser for the given Format.

Parameters
format: Format!

The Format.

Returns
Boolean

Whether the factory can instantiate a suitable SubtitleParser.