DefaultExtractorsFactory


@UnstableApi
class DefaultExtractorsFactory : ExtractorsFactory


An ExtractorsFactory that provides an array of extractors for the following formats:

Summary

Public constructors

Public functions

synchronized Array<Extractor!>!

Returns an array of new Extractor instances.

synchronized Array<Extractor!>!
createExtractors(
    uri: Uri!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!
)

Returns an array of new Extractor instances.

synchronized DefaultExtractorsFactory!
experimentalSetTextTrackTranscodingEnabled(
    textTrackTranscodingEnabled: Boolean
)

Enables transcoding of text track samples to APPLICATION_MEDIA3_CUES before the data is emitted to TrackOutput.

synchronized DefaultExtractorsFactory!

Sets flags for AdtsExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for AmrExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!
@CanIgnoreReturnValue
setConstantBitrateSeekingAlwaysEnabled(
    constantBitrateSeekingAlwaysEnabled: Boolean
)

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.

synchronized DefaultExtractorsFactory!
@CanIgnoreReturnValue
setConstantBitrateSeekingEnabled(
    constantBitrateSeekingEnabled: Boolean
)

Convenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it.

synchronized DefaultExtractorsFactory!

Sets flags for FlacExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for FragmentedMp4Extractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for JpegExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for MatroskaExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for Mp3Extractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets flags for Mp4Extractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets a SubtitleParser.Factory to use when transcoding text tracks.

synchronized DefaultExtractorsFactory!

This function is deprecated.

Use experimentalSetTextTrackTranscodingEnabled instead.

synchronized DefaultExtractorsFactory!

Sets flags for DefaultTsPayloadReaderFactorys used by TsExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets the mode for TsExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets the number of bytes searched to find a timestamp for TsExtractor instances created by the factory.

synchronized DefaultExtractorsFactory!

Sets a list of subtitle formats to pass to the DefaultTsPayloadReaderFactory used by TsExtractor instances created by the factory.

Inherited Constants

From androidx.media3.extractor.ExtractorsFactory
const ExtractorsFactory!

Extractor factory that returns an empty list of extractors.

Public constructors

DefaultExtractorsFactory

DefaultExtractorsFactory()

Public functions

createExtractors

synchronized fun createExtractors(): Array<Extractor!>!

Returns an array of new Extractor instances.

createExtractors

synchronized fun createExtractors(
    uri: Uri!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!
): Array<Extractor!>!

Returns an array of new Extractor instances.

Parameters
uri: Uri!

The Uri of the media to extract.

responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!

The response headers of the media to extract, or an empty map if there are none. The map lookup should be case-insensitive.

Returns
Array<Extractor!>!

The Extractor instances.

experimentalSetTextTrackTranscodingEnabled

synchronized fun experimentalSetTextTrackTranscodingEnabled(
    textTrackTranscodingEnabled: Boolean
): DefaultExtractorsFactory!

Enables transcoding of text track samples to APPLICATION_MEDIA3_CUES before the data is emitted to TrackOutput.

Transcoding is disabled by default.

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

Parameters
textTrackTranscodingEnabled: Boolean

Whether to enable transcoding.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

setAdtsExtractorFlags

@CanIgnoreReturnValue
synchronized fun setAdtsExtractorFlags(@AdtsExtractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for AdtsExtractor instances created by the factory.

Parameters
@AdtsExtractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
AdtsExtractor

setAmrExtractorFlags

@CanIgnoreReturnValue
synchronized fun setAmrExtractorFlags(@AmrExtractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for AmrExtractor instances created by the factory.

Parameters
@AmrExtractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
AmrExtractor

setConstantBitrateSeekingAlwaysEnabled

@CanIgnoreReturnValue
synchronized fun setConstantBitrateSeekingAlwaysEnabled(
    constantBitrateSeekingAlwaysEnabled: Boolean
): DefaultExtractorsFactory!

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
constantBitrateSeekingAlwaysEnabled: Boolean

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 fun setConstantBitrateSeekingEnabled(
    constantBitrateSeekingEnabled: Boolean
): DefaultExtractorsFactory!

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
constantBitrateSeekingEnabled: Boolean

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 fun setFlacExtractorFlags(@FlacExtractor.Flags flags: Int): DefaultExtractorsFactory!

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 flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
FlacExtractor

setFragmentedMp4ExtractorFlags

@CanIgnoreReturnValue
synchronized fun setFragmentedMp4ExtractorFlags(@FragmentedMp4Extractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for FragmentedMp4Extractor instances created by the factory.

Parameters
@FragmentedMp4Extractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

setJpegExtractorFlags

@CanIgnoreReturnValue
synchronized fun setJpegExtractorFlags(@JpegExtractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for JpegExtractor instances created by the factory.

Parameters
@JpegExtractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
JpegExtractor

setMatroskaExtractorFlags

@CanIgnoreReturnValue
synchronized fun setMatroskaExtractorFlags(@MatroskaExtractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for MatroskaExtractor instances created by the factory.

Parameters
@MatroskaExtractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

setMp3ExtractorFlags

@CanIgnoreReturnValue
synchronized fun setMp3ExtractorFlags(@Mp3Extractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for Mp3Extractor instances created by the factory.

Parameters
@Mp3Extractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
Mp3Extractor

setMp4ExtractorFlags

@CanIgnoreReturnValue
synchronized fun setMp4ExtractorFlags(@Mp4Extractor.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for Mp4Extractor instances created by the factory.

Parameters
@Mp4Extractor.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
Mp4Extractor

setSubtitleParserFactory

@CanIgnoreReturnValue
synchronized fun setSubtitleParserFactory(subtitleParserFactory: SubtitleParser.Factory!): DefaultExtractorsFactory!

Sets a SubtitleParser.Factory to use when transcoding text tracks.

This is only works if experimentalSetTextTrackTranscodingEnabled is enabled.

Parameters
subtitleParserFactory: SubtitleParser.Factory!

The factory for SubtitleParser instances.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

setTextTrackTranscodingEnabled

@CanIgnoreReturnValue
synchronized fun setTextTrackTranscodingEnabled(textTrackTranscodingEnabled: Boolean): DefaultExtractorsFactory!

setTsExtractorFlags

@CanIgnoreReturnValue
synchronized fun setTsExtractorFlags(@DefaultTsPayloadReaderFactory.Flags flags: Int): DefaultExtractorsFactory!

Sets flags for DefaultTsPayloadReaderFactorys used by TsExtractor instances created by the factory.

Parameters
@DefaultTsPayloadReaderFactory.Flags flags: Int

The flags to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
TsExtractor

setTsExtractorMode

@CanIgnoreReturnValue
synchronized fun setTsExtractorMode(@TsExtractor.Mode mode: Int): DefaultExtractorsFactory!

Sets the mode for TsExtractor instances created by the factory.

Parameters
@TsExtractor.Mode mode: Int

The mode to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
TsExtractor

setTsExtractorTimestampSearchBytes

@CanIgnoreReturnValue
synchronized fun setTsExtractorTimestampSearchBytes(timestampSearchBytes: Int): DefaultExtractorsFactory!

Sets the number of bytes searched to find a timestamp for TsExtractor instances created by the factory.

Parameters
timestampSearchBytes: Int

The number of search bytes to use.

Returns
DefaultExtractorsFactory!

The factory, for convenience.

See also
TsExtractor

setTsSubtitleFormats

@CanIgnoreReturnValue
synchronized fun setTsSubtitleFormats(subtitleFormats: (Mutable)List<Format!>!): DefaultExtractorsFactory!

Sets a list of subtitle formats to pass to the DefaultTsPayloadReaderFactory used by TsExtractor instances created by the factory.

Parameters
subtitleFormats: (Mutable)List<Format!>!

The subtitle formats.

Returns
DefaultExtractorsFactory!

The factory, for convenience.