HlsExtractorFactory


@UnstableApi
public interface HlsExtractorFactory

Known direct subclasses

Factory for HLS media chunk extractors.

Summary

Constants

default static final HlsExtractorFactory

This field is deprecated.

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

Public methods

abstract HlsMediaChunkExtractor
createExtractor(
    Uri uri,
    Format format,
    @Nullable List<Format> muxedCaptionFormats,
    TimestampAdjuster timestampAdjuster,
    Map<StringList<String>> responseHeaders,
    ExtractorInput sniffingExtractorInput,
    PlayerId playerId
)

Creates an Extractor for extracting HLS media chunks.

default HlsExtractorFactory
@CanIgnoreReturnValue
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).

default Format

Returns the output Format of emitted text samples which were originally in sourceFormat.

default HlsExtractorFactory

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

Constants

DEFAULT

default static final HlsExtractorFactory DEFAULT

Public methods

createExtractor

abstract HlsMediaChunkExtractor createExtractor(
    Uri uri,
    Format format,
    @Nullable List<Format> muxedCaptionFormats,
    TimestampAdjuster timestampAdjuster,
    Map<StringList<String>> responseHeaders,
    ExtractorInput sniffingExtractorInput,
    PlayerId playerId
)

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.

@Nullable List<Format> muxedCaptionFormats

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.

Map<StringList<String>> responseHeaders

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

ExtractorInput sniffingExtractorInput

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
default HlsExtractorFactory 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
HlsExtractorFactory

This factory, for convenience.

getOutputTextFormat

default Format getOutputTextFormat(Format sourceFormat)

Returns the output Format of emitted text samples which were originally in sourceFormat.

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

Non-text source formats are always returned without mutation.

Parameters
Format sourceFormat

The original text-based format.

Returns
Format

The Format that will be associated with a text track.

setSubtitleParserFactory

@CanIgnoreReturnValue
default HlsExtractorFactory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

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

Parameters
SubtitleParser.Factory subtitleParserFactory

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
HlsExtractorFactory

This factory, for convenience.