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.int[]
getSupportedTypes()
Returns thecontent types
supported by media sources created by this factory.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.
-
-
-
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 create media sources with sideloaded manifests viacreateMediaSource(DashManifest, MediaItem)
.
-
-
Method Detail
-
setDrmSessionManagerProvider
public DashMediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider)
Description copied from interface:MediaSource.Factory
- Specified by:
setDrmSessionManagerProvider
in interfaceMediaSource.Factory
- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
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
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.
-
setManifestParser
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
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
public 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
-
-