DashMediaSource.Factory


public final class DashMediaSource.Factory implements MediaSourceFactory


Factory for DashMediaSources.

Summary

Public constructors

Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for DashMediaSources.

Factory(
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory
)

Creates a new factory for DashMediaSources.

Public methods

DashMediaSource

Returns a new DashMediaSource using the current parameters and the specified sideloaded manifest.

DashMediaSource

Returns a new DashMediaSource using the current parameters.

DashMediaSource
createMediaSource(DashManifest manifest, MediaItem mediaItem)

Returns a new DashMediaSource using the current parameters and the specified sideloaded manifest.

DashMediaSource.Factory
@CanIgnoreReturnValue
experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)

This method is deprecated.

This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

int[]

Returns the content types supported by media sources created by this factory.

DashMediaSource.Factory

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem.

DashMediaSource.Factory

Sets the factory to create composite SequenceableLoaders for when this media source loads data from multiple streams (video, audio etc...).

DashMediaSource.Factory

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

DashMediaSource.Factory
@CanIgnoreReturnValue
setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)

Sets the target offset for live streams that is used if no value is defined in the MediaItem or the manifest.

DashMediaSource.Factory

Sets an optional LoadErrorHandlingPolicy.

DashMediaSource.Factory

Sets the manifest parser to parse loaded manifest data when loading a manifest URI.

DashMediaSource.Factory
@CanIgnoreReturnValue
setMinLiveStartPositionUs(long minLiveStartPositionUs)

Sets the minimum position to start playback from in a live stream, in microseconds relative to the start of the live window.

DashMediaSource.Factory

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction.

Public constructors

Factory

public Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for DashMediaSources.

The factory will use the following default components:

Parameters
DataSource.Factory dataSourceFactory

A factory for DataSource instances that will be used to load manifest and media data.

Factory

public Factory(
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory
)

Creates a new factory for DashMediaSources.

The factory will use the following default components:

Parameters
DashChunkSource.Factory chunkSourceFactory

A factory for DashChunkSource instances.

@Nullable DataSource.Factory manifestDataSourceFactory

A factory for DataSource instances that will be used to load (and refresh) the manifest. May be null if the factory will only ever be used to create media sources with sideloaded manifests via createMediaSource.

Public methods

createMediaSource

public DashMediaSource createMediaSource(DashManifest manifest)

Returns a new DashMediaSource using the current parameters and the specified sideloaded manifest.

Parameters
DashManifest manifest

The manifest. dynamic must be false.

Returns
DashMediaSource

The new DashMediaSource.

createMediaSource

public DashMediaSource createMediaSource(MediaItem mediaItem)

Returns a new DashMediaSource using the current parameters.

Parameters
MediaItem mediaItem

The media item of the dash stream.

Returns
DashMediaSource

The new DashMediaSource.

createMediaSource

public DashMediaSource createMediaSource(DashManifest manifest, MediaItem mediaItem)

Returns a new DashMediaSource using the current parameters and the specified sideloaded manifest.

Parameters
DashManifest manifest

The manifest. dynamic must be false.

MediaItem mediaItem

The MediaItem to be included in the timeline.

Returns
DashMediaSource

The new DashMediaSource.

experimentalParseSubtitlesDuringExtraction

@CanIgnoreReturnValue
public DashMediaSource.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 true (i.e. subtitles will be parsed during extraction).

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
DashMediaSource.Factory

This factory, for convenience.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

Returns the content types supported by media sources created by this factory.

setCmcdConfigurationFactory

@CanIgnoreReturnValue
public DashMediaSource.Factory setCmcdConfigurationFactory(
    CmcdConfiguration.Factory cmcdConfigurationFactory
)

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem.

Returns
DashMediaSource.Factory

This factory, for convenience.

setCompositeSequenceableLoaderFactory

@CanIgnoreReturnValue
public DashMediaSource.Factory setCompositeSequenceableLoaderFactory(
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory
)

Sets the factory to create composite SequenceableLoaders for when this media source loads data from multiple streams (video, audio etc...). The default is an instance of .

Parameters
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory

A factory to create composite s for when this media source loads data from multiple streams (video, audio etc...).

Returns
DashMediaSource.Factory

This factory, for convenience.

setDrmSessionManagerProvider

@CanIgnoreReturnValue
public DashMediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

Returns
DashMediaSource.Factory

This factory, for convenience.

setFallbackTargetLiveOffsetMs

@CanIgnoreReturnValue
public DashMediaSource.Factory setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)

Sets the target offset for live streams that is used if no value is defined in the MediaItem or the manifest.

The default value is DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS.

Parameters
long fallbackTargetLiveOffsetMs

The fallback live target offset in milliseconds.

Returns
DashMediaSource.Factory

This factory, for convenience.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public DashMediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
DashMediaSource.Factory

This factory, for convenience.

setManifestParser

@CanIgnoreReturnValue
public DashMediaSource.Factory setManifestParser(
    @Nullable ParsingLoadable.Parser<DashManifest> manifestParser
)

Sets the manifest parser to parse loaded manifest data when loading a manifest URI.

Parameters
@Nullable ParsingLoadable.Parser<DashManifest> manifestParser

A parser for loaded manifest data.

Returns
DashMediaSource.Factory

This factory, for convenience.

setMinLiveStartPositionUs

@CanIgnoreReturnValue
public DashMediaSource.Factory setMinLiveStartPositionUs(long minLiveStartPositionUs)

Sets the minimum position to start playback from in a live stream, in microseconds relative to the start of the live window.

This value will override any suggested value from the manifest and helps to prevent issues.

The default value is MIN_LIVE_DEFAULT_START_POSITION_US.

Parameters
long minLiveStartPositionUs

The minimum live start position, in microseconds relative to the start of the live window.

Returns
DashMediaSource.Factory

This factory, for convenience.

setSubtitleParserFactory

@CanIgnoreReturnValue
public DashMediaSource.Factory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction.

Parameters
SubtitleParser.Factory subtitleParserFactory

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
DashMediaSource.Factory

This factory, for convenience.