# SubtitleParser.Factory

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/text/SubtitleParser.java+class:androidx.media3.extractor.text.SubtitleParser.Factory)

*** ** * ** ***


```
public interface SubtitleParser.Factory
```

<br />

Known direct subclasses [DefaultSubtitleParserFactory](https://developer.android.com/reference/androidx/media3/extractor/text/DefaultSubtitleParserFactory), [ThrowingSubtitleParserFactory](https://developer.android.com/reference/androidx/media3/test/utils/ThrowingSubtitleParserFactory)

|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/DefaultSubtitleParserFactory` | A factory for `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` instances. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ThrowingSubtitleParserFactory` | A `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` for `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` instances that throw an exception on every call to `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser#parse(byte[],androidx.media3.extractor.text.SubtitleParser.OutputOptions,java.util.function.Consumer<androidx.media3.extractor.text.CuesWithTiming>)`. |

*** ** * ** ***

Factory for `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` instances.

## Summary

| ### Constants |
|---|---|
| `default static final https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` | `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#UNSUPPORTED()` A subtitle parser factory that supports no formats. |

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` | `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#create(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format format)` Creates a `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` for the given `https://developer.android.com/reference/androidx/media3/common/Format`. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/Format.CueReplacementBehavior https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#getCueReplacementBehavior(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format format)` Returns the `https://developer.android.com/reference/androidx/media3/common/Format.CueReplacementBehavior` of the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` implementation that handles `format`. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#supportsFormat(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format format)` Returns whether the factory is able to instantiate a `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` for the given `https://developer.android.com/reference/androidx/media3/common/Format`. |

## Constants

### UNSUPPORTED

```
default static final SubtitleParser.Factory UNSUPPORTED
```

A subtitle parser factory that supports no formats.

## Public methods

### create

```
abstract SubtitleParser create(Format format)
```

Creates a `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` for the given `https://developer.android.com/reference/androidx/media3/common/Format`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` | The `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `format` is `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#supportsFormat(androidx.media3.common.Format)` by this factory. |

### getCueReplacementBehavior

```
@Format.CueReplacementBehavior
abstract int getCueReplacementBehavior(Format format)
```

Returns the `https://developer.android.com/reference/androidx/media3/common/Format.CueReplacementBehavior` of the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` implementation that handles `format`.

| Returns |
|---|---|
| `int` | The replacement behavior. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `format` is `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory#supportsFormat(androidx.media3.common.Format)` by this factory. |

### supportsFormat

```
abstract boolean supportsFormat(Format format)
```

Returns whether the factory is able to instantiate a `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser` for the given `https://developer.android.com/reference/androidx/media3/common/Format`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The `https://developer.android.com/reference/androidx/media3/common/Format`. |

| Returns |
|---|---|
| `boolean` | Whether the factory can instantiate a suitable `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser`. |