Interface MediaSourceFactory
-
- All Known Implementing Classes:
DashMediaSource.Factory,DefaultMediaSourceFactory,FakeMediaSourceFactory,HlsMediaSource.Factory,ProgressiveMediaSource.Factory,RtspMediaSource.Factory,SsMediaSource.Factory
public interface MediaSourceFactoryFactory for creatingMediaSourcesfromMediaItems.
-
-
Field Summary
Fields Modifier and Type Field Description static MediaSourceFactoryUNSUPPORTEDAn instance that throwsUnsupportedOperationExceptionfromcreateMediaSource(com.google.android.exoplayer2.MediaItem)andgetSupportedTypes().
-
Method Summary
-
-
-
Field Detail
-
UNSUPPORTED
static final MediaSourceFactory UNSUPPORTED
An instance that throwsUnsupportedOperationExceptionfromcreateMediaSource(com.google.android.exoplayer2.MediaItem)andgetSupportedTypes().
-
-
Method Detail
-
setStreamKeys
@Deprecated default MediaSourceFactory setStreamKeys(@Nullable List<StreamKey> streamKeys)
Deprecated.UseMediaItem.LocalConfiguration.streamKeysinstead.
-
setDrmSessionManagerProvider
MediaSourceFactory setDrmSessionManagerProvider(@Nullable DrmSessionManagerProvider drmSessionManagerProvider)
Sets theDrmSessionManagerProviderused to obtain aDrmSessionManagerfor aMediaItem.If not set,
DefaultDrmSessionManagerProvideris used.If set, calls to the following (deprecated) methods are ignored:
- Returns:
- This factory, for convenience.
-
setDrmSessionManager
@Deprecated MediaSourceFactory setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager)
Deprecated.UsesetDrmSessionManagerProvider(DrmSessionManagerProvider)and pass an implementation that always returns the same instance.Sets theDrmSessionManagerto use for all media items regardless of theirMediaItem.DrmConfiguration.Calling this with a non-null
drmSessionManageris equivalent to callingsetDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager).- Parameters:
drmSessionManager- TheDrmSessionManager, ornullto use theDefaultDrmSessionManager.- Returns:
- This factory, for convenience.
-
setDrmHttpDataSourceFactory
@Deprecated MediaSourceFactory setDrmHttpDataSourceFactory(@Nullable HttpDataSource.Factory drmHttpDataSourceFactory)
Deprecated.UsesetDrmSessionManagerProvider(DrmSessionManagerProvider)and pass an implementation that configures the returnedDrmSessionManagerwith the desiredHttpDataSource.Factory.Sets 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.- Parameters:
drmHttpDataSourceFactory- The HTTP data source factory, ornullto useDefaultHttpDataSource.Factory.- Returns:
- This factory, for convenience.
-
setDrmUserAgent
@Deprecated MediaSourceFactory setDrmUserAgent(@Nullable String userAgent)
Deprecated.UsesetDrmSessionManagerProvider(DrmSessionManagerProvider)and pass an implementation that configures the returnedDrmSessionManagerwith the desireduserAgent.Sets the optional user agent to be used for DRM requests.Calls to this method are ignored if any of the following are provided:
- Parameters:
userAgent- The user agent to be used for DRM requests, ornullto use the default.- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
MediaSourceFactory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets an optionalLoadErrorHandlingPolicy.- Parameters:
loadErrorHandlingPolicy- ALoadErrorHandlingPolicy, ornullto use theDefaultLoadErrorHandlingPolicy.- Returns:
- This factory, for convenience.
-
getSupportedTypes
@ContentType int[] getSupportedTypes()
Returns thecontent typessupported by media sources created by this factory.
-
createMediaSource
MediaSource createMediaSource(MediaItem mediaItem)
Creates a newMediaSourcewith the specifiedMediaItem.- Parameters:
mediaItem- The media item to play.- Returns:
- The new
media source.
-
createMediaSource
@Deprecated default MediaSource createMediaSource(Uri uri)
Deprecated.UsecreateMediaSource(MediaItem)instead.
-
-