DashMediaSource.Factory
, DefaultMediaSourceFactory
, ExtractorMediaSource.Factory
, HlsMediaSource.Factory
, ProgressiveMediaSource.Factory
, SsMediaSource.Factory
public interface MediaSourceFactory
MediaSource
s from URIs.
In case a DrmSessionManager
is passed to setDrmSessionManager(DrmSessionManager)
, it will be used regardless of the drm configuration of
the media item.
For a media item with a MediaItem.DrmConfiguration
, a DefaultDrmSessionManager
is created based on that configuration. The following setter can be used to optionally configure
the creation:
setDrmHttpDataSourceFactory(HttpDataSource.Factory)
: Sets the data source factory
to be used by the HttpMediaDrmCallback
for network requests (default: DefaultHttpDataSourceFactory
).
@Deprecated default MediaSourceFactory setStreamKeys(@Nullable List<StreamKey> streamKeys)
MediaItem.PlaybackProperties.streamKeys
instead.MediaSourceFactory setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager)
DrmSessionManager
to use for all media items regardless of their MediaItem.DrmConfiguration
.drmSessionManager
- The DrmSessionManager
, or null
to use the DefaultDrmSessionManager
.MediaSourceFactory setDrmHttpDataSourceFactory(@Nullable HttpDataSource.Factory drmHttpDataSourceFactory)
HttpDataSource.Factory
to be used for creating HttpMediaDrmCallbacks
to execute key and provisioning requests over HTTP.
In case a DrmSessionManager
has been set by setDrmSessionManager(DrmSessionManager)
, this data source factory is ignored.
drmHttpDataSourceFactory
- The HTTP data source factory, or null
to use DefaultHttpDataSourceFactory
.MediaSourceFactory setDrmUserAgent(@Nullable String userAgent)
In case a factory has been set by setDrmHttpDataSourceFactory(HttpDataSource.Factory)
or a DrmSessionManager
has been
set by setDrmSessionManager(DrmSessionManager)
, this user agent is ignored.
userAgent
- The user agent to be used for DRM requests, or null
to use the
default.MediaSourceFactory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy)
LoadErrorHandlingPolicy
.loadErrorHandlingPolicy
- A LoadErrorHandlingPolicy
, or null
to use the
DefaultLoadErrorHandlingPolicy
.@ContentType int[] getSupportedTypes()
content types
supported by media sources created by this
factory.MediaSource createMediaSource(MediaItem mediaItem)
MediaSource
with the specified MediaItem
.mediaItem
- The media item to play.media source
.@Deprecated default MediaSource createMediaSource(Uri uri)
createMediaSource(MediaItem)
instead.