Class DashMediaSource.Factory
- java.lang.Object
-
- com.google.android.exoplayer2.source.dash.DashMediaSource.Factory
-
- All Implemented Interfaces:
MediaSource.Factory
,MediaSourceFactory
- Enclosing class:
- DashMediaSource
public static final class DashMediaSource.Factory extends Object implements MediaSourceFactory
Factory forDashMediaSource
s.
-
-
Field Summary
-
Fields inherited from interface com.google.android.exoplayer2.source.MediaSourceFactory
UNSUPPORTED
-
-
Constructor Summary
Constructors Constructor Description Factory(DashChunkSource.Factory chunkSourceFactory, DataSource.Factory manifestDataSourceFactory)
Creates a new factory forDashMediaSource
s.Factory(DataSource.Factory dataSourceFactory)
Creates a new factory forDashMediaSource
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DashMediaSource
createMediaSource(MediaItem mediaItem)
Returns a newDashMediaSource
using the current parameters.DashMediaSource
createMediaSource(DashManifest manifest)
Returns a newDashMediaSource
using the current parameters and the specified sideloaded manifest.DashMediaSource
createMediaSource(DashManifest manifest, MediaItem mediaItem)
Returns a newDashMediaSource
using the current parameters and the specified sideloaded manifest.@com.google.android.exoplayer2.C.ContentType int[]
getSupportedTypes()
Returns thecontent types
supported by media sources created by this factory.DashMediaSource.Factory
setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)
DashMediaSource.Factory
setCompositeSequenceableLoaderFactory(CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)
Sets the factory to create compositeSequenceableLoader
s for when this media source loads data from multiple streams (video, audio etc...).DashMediaSource.Factory
setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider)
DashMediaSource.Factory
setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)
Sets the targetoffset for live streams
that is used if no value is defined in theMediaItem
or the manifest.DashMediaSource.Factory
setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets an optionalLoadErrorHandlingPolicy
.DashMediaSource.Factory
setManifestParser(ParsingLoadable.Parser<? extends DashManifest> manifestParser)
Sets the manifest parser to parse loaded manifest data when loading a manifest URI.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.
-
-
-
Constructor Detail
-
Factory
public Factory(DataSource.Factory dataSourceFactory)
Creates a new factory forDashMediaSource
s.The factory will use the following default components:
- Parameters:
dataSourceFactory
- A factory forDataSource
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 forDashMediaSource
s.The factory will use the following default components:
- Parameters:
chunkSourceFactory
- A factory forDashChunkSource
instances.manifestDataSourceFactory
- A factory forDataSource
instances that will be used to load (and refresh) the manifest. May benull
if the factory will only ever be used to create media sources with sideloaded manifests viacreateMediaSource(DashManifest, MediaItem)
.
-
-
Method Detail
-
setCmcdConfigurationFactory
@CanIgnoreReturnValue public DashMediaSource.Factory setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)
Description copied from interface:MediaSource.Factory
- Specified by:
setCmcdConfigurationFactory
in interfaceMediaSource.Factory
- Returns:
- This factory, for convenience.
-
setDrmSessionManagerProvider
@CanIgnoreReturnValue public DashMediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider)
Description copied from interface:MediaSource.Factory
- Specified by:
setDrmSessionManagerProvider
in interfaceMediaSource.Factory
- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
@CanIgnoreReturnValue public DashMediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Description copied from interface:MediaSource.Factory
Sets an optionalLoadErrorHandlingPolicy
.- Specified by:
setLoadErrorHandlingPolicy
in interfaceMediaSource.Factory
- Returns:
- This factory, for convenience.
-
setFallbackTargetLiveOffsetMs
@CanIgnoreReturnValue public DashMediaSource.Factory setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)
Sets the targetoffset for live streams
that is used if no value is defined in theMediaItem
or the manifest.The default value is
DashMediaSource.DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS
.- Parameters:
fallbackTargetLiveOffsetMs
- The fallback live target offset in milliseconds.- Returns:
- 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
BehindLiveWindowException
issues.The default value is
DashMediaSource.MIN_LIVE_DEFAULT_START_POSITION_US
.- Parameters:
minLiveStartPositionUs
- The minimum live start position, in microseconds relative to the start of the live window.- Returns:
- This factory, for convenience.
-
setManifestParser
@CanIgnoreReturnValue public DashMediaSource.Factory setManifestParser(@Nullable ParsingLoadable.Parser<? extends DashManifest> manifestParser)
Sets the manifest parser to parse loaded manifest data when loading a manifest URI.- Parameters:
manifestParser
- A parser for loaded manifest data.- Returns:
- This factory, for convenience.
-
setCompositeSequenceableLoaderFactory
@CanIgnoreReturnValue public DashMediaSource.Factory setCompositeSequenceableLoaderFactory(CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)
Sets the factory to create compositeSequenceableLoader
s for when this media source loads data from multiple streams (video, audio etc...). The default is an instance ofDefaultCompositeSequenceableLoaderFactory
.- Parameters:
compositeSequenceableLoaderFactory
- A factory to create compositeSequenceableLoader
s for when this media source loads data from multiple streams (video, audio etc...).- Returns:
- This factory, for convenience.
-
createMediaSource
public DashMediaSource createMediaSource(DashManifest manifest)
Returns a newDashMediaSource
using the current parameters and the specified sideloaded manifest.- Parameters:
manifest
- The manifest.DashManifest.dynamic
must be false.- Returns:
- The new
DashMediaSource
. - Throws:
IllegalArgumentException
- IfDashManifest.dynamic
is true.
-
createMediaSource
public DashMediaSource createMediaSource(DashManifest manifest, MediaItem mediaItem)
Returns a newDashMediaSource
using the current parameters and the specified sideloaded manifest.- Parameters:
manifest
- The manifest.DashManifest.dynamic
must be false.mediaItem
- TheMediaItem
to be included in the timeline.- Returns:
- The new
DashMediaSource
. - Throws:
IllegalArgumentException
- IfDashManifest.dynamic
is true.
-
createMediaSource
public DashMediaSource createMediaSource(MediaItem mediaItem)
Returns a newDashMediaSource
using the current parameters.- Specified by:
createMediaSource
in interfaceMediaSource.Factory
- Parameters:
mediaItem
- The media item of the dash stream.- Returns:
- The new
DashMediaSource
. - Throws:
NullPointerException
- ifMediaItem.localConfiguration
isnull
.
-
getSupportedTypes
@ContentType public @com.google.android.exoplayer2.C.ContentType int[] getSupportedTypes()
Description copied from interface:MediaSource.Factory
Returns thecontent types
supported by media sources created by this factory.- Specified by:
getSupportedTypes
in interfaceMediaSource.Factory
-
-