Class DashMediaSource.Factory
- java.lang.Object
-
- com.google.android.exoplayer2.source.dash.DashMediaSource.Factory
-
- All Implemented Interfaces:
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
-
-
-
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
-
setTag
@Deprecated public DashMediaSource.Factory setTag(@Nullable Object tag)
Deprecated.UseMediaItem.Builder.setTag(Object)andcreateMediaSource(MediaItem)instead.
-
setStreamKeys
@Deprecated public DashMediaSource.Factory setStreamKeys(@Nullable List<StreamKey> streamKeys)
Deprecated.UseMediaItem.Builder.setStreamKeys(List)andcreateMediaSource(MediaItem)instead.- Specified by:
setStreamKeysin interfaceMediaSourceFactory
-
setDrmSessionManagerProvider
public DashMediaSource.Factory setDrmSessionManagerProvider(@Nullable DrmSessionManagerProvider drmSessionManagerProvider)
Description copied from interface:MediaSourceFactorySets theDrmSessionManagerProviderused to obtain aDrmSessionManagerfor aMediaItem.If not set,
DefaultDrmSessionManagerProvideris used.If set, calls to the following (deprecated) methods are ignored:
- Specified by:
setDrmSessionManagerProviderin interfaceMediaSourceFactory- Returns:
- This factory, for convenience.
-
setDrmSessionManager
@Deprecated public DashMediaSource.Factory setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager)
Deprecated.Description copied from interface:MediaSourceFactorySets theDrmSessionManagerto use for all media items regardless of theirMediaItem.DrmConfiguration.Calling this with a non-null
drmSessionManageris equivalent to callingsetDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager).- Specified by:
setDrmSessionManagerin interfaceMediaSourceFactory- Parameters:
drmSessionManager- TheDrmSessionManager, ornullto use theDefaultDrmSessionManager.- Returns:
- This factory, for convenience.
-
setDrmHttpDataSourceFactory
@Deprecated public DashMediaSource.Factory setDrmHttpDataSourceFactory(@Nullable HttpDataSource.Factory drmHttpDataSourceFactory)
Deprecated.Description copied from interface:MediaSourceFactorySets theHttpDataSource.Factoryto be used for creatingHttpMediaDrmCallbacksto execute key and provisioning requests over HTTP.Calls to this method are ignored if either a
DrmSessionManager providerorconcrete DrmSessionManagerare provided.- Specified by:
setDrmHttpDataSourceFactoryin interfaceMediaSourceFactory- Parameters:
drmHttpDataSourceFactory- The HTTP data source factory, ornullto useDefaultHttpDataSource.Factory.- Returns:
- This factory, for convenience.
-
setDrmUserAgent
@Deprecated public DashMediaSource.Factory setDrmUserAgent(@Nullable String userAgent)
Deprecated.Description copied from interface:MediaSourceFactorySets the optional user agent to be used for DRM requests.Calls to this method are ignored if any of the following are provided:
- Specified by:
setDrmUserAgentin interfaceMediaSourceFactory- Parameters:
userAgent- The user agent to be used for DRM requests, ornullto use the default.- 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 interfaceMediaSourceFactory- Parameters:
loadErrorHandlingPolicy- ALoadErrorHandlingPolicy.- Returns:
- This factory, for convenience.
-
setLivePresentationDelayMs
@Deprecated public DashMediaSource.Factory setLivePresentationDelayMs(long livePresentationDelayMs, boolean overridesManifest)
Deprecated.UseMediaItem.Builder.setLiveConfiguration(MediaItem.LiveConfiguration)andMediaItem.LiveConfiguration.Builder.setTargetOffsetMs(long)to override the manifest, orsetFallbackTargetLiveOffsetMs(long)to provide a fallback value.
-
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
@Deprecated public DashMediaSource createMediaSource(Uri uri)
Deprecated.UsecreateMediaSource(MediaItem)instead.- Specified by:
createMediaSourcein interfaceMediaSourceFactory
-
createMediaSource
public DashMediaSource createMediaSource(MediaItem mediaItem)
Returns a newDashMediaSourceusing the current parameters.- Specified by:
createMediaSourcein interfaceMediaSourceFactory- 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:MediaSourceFactoryReturns thecontent typessupported by media sources created by this factory.- Specified by:
getSupportedTypesin interfaceMediaSourceFactory
-
-