DefaultHlsExtractorFactory


@UnstableApi
class DefaultHlsExtractorFactory : HlsExtractorFactory


Default HlsExtractorFactory implementation.

Summary

Public constructors

Equivalent to new DefaultHlsExtractorFactory(payloadReaderFactoryFlags = 0, exposeCea608WhenMissingDeclarations = true)

DefaultHlsExtractorFactory(
    payloadReaderFactoryFlags: Int,
    exposeCea608WhenMissingDeclarations: Boolean
)

Creates a factory for HLS segment extractors.

Public functions

BundledHlsMediaChunkExtractor!
createExtractor(
    uri: Uri!,
    format: Format!,
    muxedCaptionFormats: (Mutable)List<Format!>?,
    timestampAdjuster: TimestampAdjuster!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!,
    sniffingExtractorInput: ExtractorInput!,
    playerId: PlayerId!
)

Creates an Extractor for extracting HLS media chunks.

DefaultHlsExtractorFactory!

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).

Format!
getOutputTextFormat(sourceFormat: Format!)

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

DefaultHlsExtractorFactory!

Sets the SubtitleParser.Factory to use for parsing subtitles during extraction.

Inherited Constants

From androidx.media3.exoplayer.hls.HlsExtractorFactory
const HlsExtractorFactory!

This property is deprecated.

HlsExtractorFactory instances are mutable, so sharing one in a static field is not safe.

Public constructors

DefaultHlsExtractorFactory

DefaultHlsExtractorFactory(
    payloadReaderFactoryFlags: Int,
    exposeCea608WhenMissingDeclarations: Boolean
)

Creates a factory for HLS segment extractors.

Parameters
payloadReaderFactoryFlags: Int

Flags to add when constructing any instances. Other flags may be added on top of payloadReaderFactoryFlags when creating DefaultTsPayloadReaderFactory.

exposeCea608WhenMissingDeclarations: Boolean

Whether created TsExtractor instances should expose a CEA-608 track should the multivariant playlist contain no Closed Captions declarations. If the multivariant playlist contains any Closed Captions declarations, this flag is ignored.

Public functions

createExtractor

fun createExtractor(
    uri: Uri!,
    format: Format!,
    muxedCaptionFormats: (Mutable)List<Format!>?,
    timestampAdjuster: TimestampAdjuster!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!,
    sniffingExtractorInput: ExtractorInput!,
    playerId: PlayerId!
): BundledHlsMediaChunkExtractor!

Creates an Extractor for extracting HLS media chunks.

Parameters
uri: Uri!

The URI of the media chunk.

format: Format!

A Format associated with the chunk to extract.

muxedCaptionFormats: (Mutable)List<Format!>?

List of muxed caption Formats. Null if no closed caption information is available in the multivariant playlist.

timestampAdjuster: TimestampAdjuster!

Adjuster corresponding to the provided discontinuity sequence number.

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

The HTTP response headers associated with the media segment or initialization section to extract.

sniffingExtractorInput: ExtractorInput!

The first extractor input that will be passed to the returned extractor's read. Must only be used to call sniff.

playerId: PlayerId!

The PlayerId of the player using this extractors factory.

Throws
java.io.IOException

If an I/O error is encountered while sniffing.

experimentalParseSubtitlesDuringExtraction

@CanIgnoreReturnValue
fun experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
): DefaultHlsExtractorFactory!

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

Whether to parse subtitles during extraction or rendering.

Returns
DefaultHlsExtractorFactory!

This factory, for convenience.

getOutputTextFormat

fun getOutputTextFormat(sourceFormat: Format!): Format!

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 APPLICATION_MEDIA3_CUES if it is supported by SubtitleParser.Factory.

To modify the support behavior, you can set your own subtitle parser factory.

setSubtitleParserFactory

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

Sets the SubtitleParser.Factory to use for parsing subtitles during extraction. The default factory value is implementation dependent.

Parameters
subtitleParserFactory: SubtitleParser.Factory!

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
DefaultHlsExtractorFactory!

This factory, for convenience.