# MediaParserChunkExtractor.Factory

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

*** ** * ** ***


```
public class MediaParserChunkExtractor.Factory implements ChunkExtractor.Factory
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory` for `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#Factory()()` |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#createProgressiveMediaExtractor(int,androidx.media3.common.Format,boolean,java.util.List<androidx.media3.common.Format>,androidx.media3.extractor.TrackOutput,androidx.media3.exoplayer.analytics.PlayerId)( @https://developer.android.com/reference/androidx/media3/common/C.TrackType int primaryTrackType, https://developer.android.com/reference/androidx/media3/common/Format representationFormat, boolean enableEventMessageTrack, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> closedCaptionFormats, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/TrackOutput playerEmsgTrackOutput, https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId )` Returns a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#experimentalParseSubtitlesDuringExtraction(boolean)( boolean parseSubtitlesDuringExtraction )` Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). |
| `https://developer.android.com/reference/androidx/media3/common/Format` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#getOutputTextFormat(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format sourceFormat)` Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)(https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory subtitleParserFactory)` Sets the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. |

## Public constructors

### Factory

```
public Factory()
```

## Public methods

### createProgressiveMediaExtractor

```
public @Nullable ChunkExtractor createProgressiveMediaExtractor(
    @C.TrackType int primaryTrackType,
    Format representationFormat,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput playerEmsgTrackOutput,
    PlayerId playerId
)
```

Returns a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.TrackType int primaryTrackType` | The `https://developer.android.com/reference/androidx/media3/common/C.TrackType` of the primary track. |
| `https://developer.android.com/reference/androidx/media3/common/Format representationFormat` | The format of the representation to extract from. |
| `boolean enableEventMessageTrack` | Whether to enable the event message track. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> closedCaptionFormats` | The `https://developer.android.com/reference/androidx/media3/common/Format` of the Closed-Caption tracks. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/TrackOutput playerEmsgTrackOutput` | The `https://developer.android.com/reference/androidx/media3/extractor/TrackOutput` for extracted EMSG messages, or null. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` of the player using this chunk extractor. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` | A new `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance, or null if not applicable. |

### experimentalParseSubtitlesDuringExtraction

```
@CanIgnoreReturnValue
public MediaParserChunkExtractor.Factory experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)
```

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). Defaults to `false` (i.e. subtitles will be parsed as part of rendering).

This method is experimental and will be renamed or removed in a future release.

| Parameters |
|---|---|
| `boolean parseSubtitlesDuringExtraction` | Whether to parse subtitles during extraction or rendering. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory` | This factory, for convenience. |

### getOutputTextFormat

```
public Format getOutputTextFormat(Format sourceFormat)
```

Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}.

In many cases, where an emits samples from the source without mutation, this method simply returns sourceFormat}. In other cases, such as an that transcodes subtitles from the sourceFormat} to \* MimeTypes#APPLICATION_MEDIA3_CUES, the format is updated to indicate the transcoding that is taking place.

Non-text source formats are always returned without mutation.

This implementation performs transcoding of the original format to `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()` if it is supported by `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory`.

To modify the support behavior, you can `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)`.

### setSubtitleParserFactory

```
@CanIgnoreReturnValue
public MediaParserChunkExtractor.Factory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)
```

Sets the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. The default factory value is implementation dependent.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory subtitleParserFactory` | The `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` for parsing subtitles during extraction. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory` | This factory, for convenience. |