public final class SsMediaSource.Factory implements MediaSourceFactory


Factory for SsMediaSource.

Summary

Public constructors

Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for SsMediaSources.

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

Creates a new factory for SsMediaSources.

Public methods

SsMediaSource

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

SsMediaSource

Returns a new SsMediaSource using the current parameters.

SsMediaSource
createMediaSource(SsManifest manifest, MediaItem mediaItem)

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

SsMediaSource.Factory
@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).

int[]

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

SsMediaSource.Factory

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

SsMediaSource.Factory

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

SsMediaSource.Factory

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

SsMediaSource.Factory
@CanIgnoreReturnValue
setLivePresentationDelayMs(long livePresentationDelayMs)

Sets the duration in milliseconds by which the default start position should precede the end of the live window for live playbacks.

SsMediaSource.Factory

Sets an optional LoadErrorHandlingPolicy.

SsMediaSource.Factory

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

SsMediaSource.Factory

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction if experimentalParseSubtitlesDuringExtraction is enabled.

Public constructors

Factory

public Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for SsMediaSources.

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(
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory
)

Creates a new factory for SsMediaSources. The factory will use the following default components:

Parameters
SsChunkSource.Factory chunkSourceFactory

A factory for SsChunkSource 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 create media sources with sideloaded manifests via createMediaSource.

Public methods

createMediaSource

public SsMediaSource createMediaSource(SsManifest manifest)

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

Parameters
SsManifest manifest

The manifest. isLive must be false.

Returns
SsMediaSource

The new SsMediaSource.

createMediaSource

public SsMediaSource createMediaSource(MediaItem mediaItem)

Returns a new SsMediaSource using the current parameters.

Parameters
MediaItem mediaItem

The MediaItem.

Returns
SsMediaSource

The new SsMediaSource.

createMediaSource

public SsMediaSource createMediaSource(SsManifest manifest, MediaItem mediaItem)

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

Parameters
SsManifest manifest

The manifest. isLive must be false.

MediaItem mediaItem

The MediaItem to be included in the timeline.

Returns
SsMediaSource

The new SsMediaSource.

experimentalParseSubtitlesDuringExtraction

@CanIgnoreReturnValue
public SsMediaSource.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 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
SsMediaSource.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 SsMediaSource.Factory setCmcdConfigurationFactory(
    CmcdConfiguration.Factory cmcdConfigurationFactory
)

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

Returns
SsMediaSource.Factory

This factory, for convenience.

setCompositeSequenceableLoaderFactory

@CanIgnoreReturnValue
public SsMediaSource.Factory setCompositeSequenceableLoaderFactory(
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory
)

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

Parameters
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory

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

Returns
SsMediaSource.Factory

This factory, for convenience.

setDrmSessionManagerProvider

@CanIgnoreReturnValue
public SsMediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

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

Returns
SsMediaSource.Factory

This factory, for convenience.

setLivePresentationDelayMs

@CanIgnoreReturnValue
public SsMediaSource.Factory setLivePresentationDelayMs(long livePresentationDelayMs)

Sets the duration in milliseconds by which the default start position should precede the end of the live window for live playbacks. The default value is DEFAULT_LIVE_PRESENTATION_DELAY_MS.

Parameters
long livePresentationDelayMs

For live playbacks, the duration in milliseconds by which the default start position should precede the end of the live window.

Returns
SsMediaSource.Factory

This factory, for convenience.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public SsMediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
SsMediaSource.Factory

This factory, for convenience.

setManifestParser

@CanIgnoreReturnValue
public SsMediaSource.Factory setManifestParser(
    @Nullable ParsingLoadable.Parser<SsManifest> manifestParser
)

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

Parameters
@Nullable ParsingLoadable.Parser<SsManifest> manifestParser

A parser for loaded manifest data.

Returns
SsMediaSource.Factory

This factory, for convenience.

setSubtitleParserFactory

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

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction if experimentalParseSubtitlesDuringExtraction is enabled.

Parameters
SubtitleParser.Factory subtitleParserFactory

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
SsMediaSource.Factory

This factory, for convenience.