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.@com.google.android.exoplayer2.C.ContentType int[]getSupportedTypes()Returns thecontent typessupported by media sources created by this factory.DashMediaSource.FactorysetCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)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 an optionalLoadErrorHandlingPolicy.DashMediaSource.FactorysetManifestParser(ParsingLoadable.Parser<? extends DashManifest> manifestParser)Sets the manifest parser to parse loaded manifest data when loading a manifest URI.DashMediaSource.FactorysetMinLiveStartPositionUs(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 forDashMediaSources.The factory will use the following default components:
- 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.The factory will use the following default components:
- 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 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:
setCmcdConfigurationFactoryin interfaceMediaSource.Factory- Returns:
- This factory, for convenience.
-
setDrmSessionManagerProvider
@CanIgnoreReturnValue public DashMediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider)
Description copied from interface:MediaSource.Factory- Specified by:
setDrmSessionManagerProviderin interfaceMediaSource.Factory- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
@CanIgnoreReturnValue public DashMediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Description copied from interface:MediaSource.FactorySets an optionalLoadErrorHandlingPolicy.- Specified by:
setLoadErrorHandlingPolicyin interfaceMediaSource.Factory- Returns:
- This factory, for convenience.
-
setFallbackTargetLiveOffsetMs
@CanIgnoreReturnValue 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.
-
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
BehindLiveWindowExceptionissues.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 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
@ContentType public @com.google.android.exoplayer2.C.ContentType int[] getSupportedTypes()
Description copied from interface:MediaSource.FactoryReturns thecontent typessupported by media sources created by this factory.- Specified by:
getSupportedTypesin interfaceMediaSource.Factory
-
-