DefaultExtractorsFactory
@UnstableApi
public final class DefaultExtractorsFactory implements ExtractorsFactory
An ExtractorsFactory that provides an array of extractors for the following formats:
- MP4, including M4A (
Mp4Extractor) - fMP4 (
FragmentedMp4Extractor) - Matroska and WebM (
MatroskaExtractor) - Ogg Vorbis/FLAC (
OggExtractor - MP3 (
Mp3Extractor) - AAC (
AdtsExtractor) - MPEG TS (
TsExtractor) - MPEG PS (
PsExtractor) - FLV (
FlvExtractor) - WAV (
WavExtractor) - AC3 (
Ac3Extractor) - AC4 (
Ac4Extractor) - AMR (
AmrExtractor) - FLAC
- If available, the FLAC extension's
androidx.media3.decoder.flac.FlacExtractoris used. - Otherwise, the core
FlacExtractoris used. Note that Android devices do not generally include a FLAC decoder before API 27. This can be worked around by using the FLAC extension or the FFmpeg extension.
- If available, the FLAC extension's
- JPEG (
JpegExtractor) - PNG (
PngExtractor) - WEBP (
WebpExtractor) - BMP (
BmpExtractor) - HEIF (
HeifExtractor) - AVIF (
AvifExtractor) - MIDI, if available, the MIDI extension's
androidx.media3.decoder.midi.MidiExtractoris used.
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
synchronized Extractor[] |
Returns an array of new |
synchronized Extractor[] |
Returns an array of new |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueSets the set of video codecs for which within GOP sample dependency information should be parsed as part of extraction. |
synchronized DefaultExtractorsFactory |
This method is deprecated. This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release. |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueConvenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it, and if it should be enabled even if the content length (and hence the duration of the media) is unknown. |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueConvenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it. |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueSets a |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueThis method is deprecated. This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release. |
synchronized DefaultExtractorsFactory |
Sets flags for |
synchronized DefaultExtractorsFactory |
Sets the mode for |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueSets the number of bytes searched to find a timestamp for |
synchronized DefaultExtractorsFactory |
@CanIgnoreReturnValueSets a list of subtitle formats to pass to the |
Inherited Constants |
||
|---|---|---|
|
Public constructors
Public methods
createExtractors
synchronized public Extractor[] createExtractors()
Returns an array of new Extractor instances.
createExtractors
synchronized public Extractor[] createExtractors(Uri uri, Map<String, List<String>> responseHeaders)
Returns an array of new Extractor instances.
| Parameters | |
|---|---|
Uri uri |
The |
Map<String, List<String>> responseHeaders |
The response headers of the media to extract, or an empty map if there are none. The map lookup should be case-insensitive. |
| Returns | |
|---|---|
Extractor[] |
The |
experimentalSetCodecsToParseWithinGopSampleDependencies
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory experimentalSetCodecsToParseWithinGopSampleDependencies(
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies
)
Sets the set of video codecs for which within GOP sample dependency information should be parsed as part of extraction. Defaults to 0 - empty set of codecs.
Having access to additional sample dependency information can speed up seeking. See FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES.
This method is experimental and will be renamed or removed in a future release.
| Parameters | |
|---|---|
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies |
The set of codecs for which to parse within GOP sample dependency information. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
This factory, for convenience. |
experimentalSetTextTrackTranscodingEnabled
synchronized public DefaultExtractorsFactoryexperimentalSetTextTrackTranscodingEnabled(
boolean textTrackTranscodingEnabled
)
Enables transcoding of text track samples to APPLICATION_MEDIA3_CUES before the data is emitted to TrackOutput.
Transcoding is enabled by default.
This method is experimental and will be renamed or removed in a future release.
| Parameters | |
|---|---|
boolean textTrackTranscodingEnabled |
Whether to enable transcoding. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
setAdtsExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setAdtsExtractorFlags(@AdtsExtractor.Flags int flags)
Sets flags for AdtsExtractor instances created by the factory.
| Parameters | |
|---|---|
@AdtsExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
AdtsExtractor |
setAmrExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setAmrExtractorFlags(@AmrExtractor.Flags int flags)
Sets flags for AmrExtractor instances created by the factory.
| Parameters | |
|---|---|
@AmrExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
AmrExtractor |
setConstantBitrateSeekingAlwaysEnabled
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setConstantBitrateSeekingAlwaysEnabled(
boolean constantBitrateSeekingAlwaysEnabled
)
Convenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it, and if it should be enabled even if the content length (and hence the duration of the media) is unknown. If set to true, the flags required to enable this functionality will be OR'd with those passed to the setters when creating extractor instances. If set to false then the flags passed to the setters will be used without modification.
When seeking into content where the length is unknown, application code should ensure that requested seek positions are valid, or should be ready to handle playback failures reported through onPlayerError with errorCode set to ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE.
| Parameters | |
|---|---|
boolean constantBitrateSeekingAlwaysEnabled |
Whether approximate seeking using a constant bitrate assumption should be enabled for all extractors that support it, including when the content duration is unknown. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
setConstantBitrateSeekingEnabled
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setConstantBitrateSeekingEnabled(
boolean constantBitrateSeekingEnabled
)
Convenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it. If set to true, the flags required to enable this functionality will be OR'd with those passed to the setters when creating extractor instances. If set to false then the flags passed to the setters will be used without modification.
| Parameters | |
|---|---|
boolean constantBitrateSeekingEnabled |
Whether approximate seeking using a constant bitrate assumption should be enabled for all extractors that support it. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
setFlacExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setFlacExtractorFlags(@FlacExtractor.Flags int flags)
Sets flags for FlacExtractor instances created by the factory. The flags are also used by androidx.media3.decoder.flac.FlacExtractor instances if the FLAC extension is being used.
| Parameters | |
|---|---|
@FlacExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
FlacExtractor |
setFragmentedMp4ExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setFragmentedMp4ExtractorFlags(@FragmentedMp4Extractor.Flags int flags)
Sets flags for FragmentedMp4Extractor instances created by the factory.
| Parameters | |
|---|---|
@FragmentedMp4Extractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
FragmentedMp4Extractor |
setHeifExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setHeifExtractorFlags(@HeifExtractor.Flags int flags)
Sets flags for HeifExtractor instances created by the factory.
| Parameters | |
|---|---|
@HeifExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
HeifExtractor |
setJpegExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setJpegExtractorFlags(@JpegExtractor.Flags int flags)
Sets flags for JpegExtractor instances created by the factory.
| Parameters | |
|---|---|
@JpegExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
JpegExtractor |
setMatroskaExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setMatroskaExtractorFlags(@MatroskaExtractor.Flags int flags)
Sets flags for MatroskaExtractor instances created by the factory.
| Parameters | |
|---|---|
@MatroskaExtractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
MatroskaExtractor |
setMp3ExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setMp3ExtractorFlags(@Mp3Extractor.Flags int flags)
Sets flags for Mp3Extractor instances created by the factory.
| Parameters | |
|---|---|
@Mp3Extractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
Mp3Extractor |
setMp4ExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setMp4ExtractorFlags(@Mp4Extractor.Flags int flags)
Sets flags for Mp4Extractor instances created by the factory.
| Parameters | |
|---|---|
@Mp4Extractor.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
Mp4Extractor |
setSubtitleParserFactory
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)
Sets a SubtitleParser.Factory to use when transcoding text tracks.
This is only works if experimentalSetTextTrackTranscodingEnabled is enabled.
| Parameters | |
|---|---|
SubtitleParser.Factory subtitleParserFactory |
The factory for |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
setTextTrackTranscodingEnabled
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactorysetTextTrackTranscodingEnabled(boolean textTrackTranscodingEnabled)
setTsExtractorFlags
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setTsExtractorFlags(@DefaultTsPayloadReaderFactory.Flags int flags)
Sets flags for DefaultTsPayloadReaderFactorys used by TsExtractor instances created by the factory.
| Parameters | |
|---|---|
@DefaultTsPayloadReaderFactory.Flags int flags |
The flags to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
TsExtractor |
setTsExtractorMode
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setTsExtractorMode(@TsExtractor.Mode int mode)
Sets the mode for TsExtractor instances created by the factory.
| Parameters | |
|---|---|
@TsExtractor.Mode int mode |
The mode to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
TsExtractor |
setTsExtractorTimestampSearchBytes
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setTsExtractorTimestampSearchBytes(int timestampSearchBytes)
Sets the number of bytes searched to find a timestamp for TsExtractor instances created by the factory.
| Parameters | |
|---|---|
int timestampSearchBytes |
The number of search bytes to use. |
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
TsExtractor |
setTsSubtitleFormats
@CanIgnoreReturnValue
synchronized public DefaultExtractorsFactory setTsSubtitleFormats(List<Format> subtitleFormats)
Sets a list of subtitle formats to pass to the DefaultTsPayloadReaderFactory used by TsExtractor instances created by the factory.
| Returns | |
|---|---|
DefaultExtractorsFactory |
The factory, for convenience. |
| See also | |
|---|---|
DefaultTsPayloadReaderFactory |