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 forDashMediaSources.
-
-
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 forDashMediaSources.Factory(DataSource.Factory dataSourceFactory)Creates a new factory forDashMediaSources.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DashMediaSourcecreateMediaSource(MediaItem mediaItem)Returns a newDashMediaSourceusing the current parameters.DashMediaSourcecreateMediaSource(DashManifest manifest)Returns a newDashMediaSourceusing the current parameters and the specified sideloaded manifest.DashMediaSourcecreateMediaSource(DashManifest manifest, MediaItem mediaItem)Returns a newDashMediaSourceusing the current parameters and the specified sideloaded manifest.int[]getSupportedTypes()Returns thecontent typessupported by media sources created by this factory.DashMediaSource.FactorysetCompositeSequenceableLoaderFactory(CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)Sets the factory to create compositeSequenceableLoaders for when this media source loads data from multiple streams (video, audio etc...).DashMediaSource.FactorysetDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider)DashMediaSource.FactorysetFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)Sets the targetoffset for live streamsthat is used if no value is defined in theMediaItemor the manifest.DashMediaSource.FactorysetLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)Sets theLoadErrorHandlingPolicy.DashMediaSource.FactorysetManifestParser(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 forDashMediaSources.- Parameters:
dataSourceFactory- A factory forDataSourceinstances that will be used to load manifest and media data.
-
Factory
public Factory(DashChunkSource.Factory chunkSourceFactory, @Nullable DataSource.Factory manifestDataSourceFactory)
Creates a new factory forDashMediaSources.- Parameters:
chunkSourceFactory- A factory forDashChunkSourceinstances.manifestDataSourceFactory- A factory forDataSourceinstances that will be used to load (and refresh) the manifest. May benullif 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(@Nullable DrmSessionManagerProvider drmSessionManagerProvider)
Description copied from interface:MediaSource.FactorySets theDrmSessionManagerProviderused to obtain aDrmSessionManagerfor aMediaItem.If not set,
DefaultDrmSessionManagerProvideris used.- Specified by:
setDrmSessionManagerProviderin interfaceMediaSource.Factory- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
public DashMediaSource.Factory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets theLoadErrorHandlingPolicy. The default value is created by callingDefaultLoadErrorHandlingPolicy().- Specified by:
setLoadErrorHandlingPolicyin interfaceMediaSource.Factory- Parameters:
loadErrorHandlingPolicy- ALoadErrorHandlingPolicy.- Returns:
- This factory, for convenience.
-
setFallbackTargetLiveOffsetMs
public DashMediaSource.Factory setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs)
Sets the targetoffset for live streamsthat is used if no value is defined in theMediaItemor 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(@Nullable CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)
Sets the factory to create compositeSequenceableLoaders 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 compositeSequenceableLoaders 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 newDashMediaSourceusing the current parameters and the specified sideloaded manifest.- Parameters:
manifest- The manifest.DashManifest.dynamicmust be false.- Returns:
- The new
DashMediaSource. - Throws:
IllegalArgumentException- IfDashManifest.dynamicis true.
-
createMediaSource
public DashMediaSource createMediaSource(DashManifest manifest, MediaItem mediaItem)
Returns a newDashMediaSourceusing the current parameters and the specified sideloaded manifest.- Parameters:
manifest- The manifest.DashManifest.dynamicmust be false.mediaItem- TheMediaItemto be included in the timeline.- Returns:
- The new
DashMediaSource. - Throws:
IllegalArgumentException- IfDashManifest.dynamicis true.
-
createMediaSource
public DashMediaSource createMediaSource(MediaItem mediaItem)
Returns a newDashMediaSourceusing the current parameters.- Specified by:
createMediaSourcein interfaceMediaSource.Factory- Parameters:
mediaItem- The media item of the dash stream.- Returns:
- The new
DashMediaSource. - Throws:
NullPointerException- ifMediaItem.localConfigurationisnull.
-
getSupportedTypes
public int[] getSupportedTypes()
Description copied from interface:MediaSource.FactoryReturns thecontent typessupported by media sources created by this factory.- Specified by:
getSupportedTypesin interfaceMediaSource.Factory
-
-