public static final class HlsMediaSource.Factory
extends java.lang.Object
implements com.google.android.exoplayer2.source.ads.AdsMediaSource.MediaSourceFactory
HlsMediaSources.| Constructor and Description |
|---|
Factory(com.google.android.exoplayer2.upstream.DataSource.Factory dataSourceFactory)
Creates a new factory for
HlsMediaSources. |
Factory(HlsDataSourceFactory hlsDataSourceFactory)
Creates a new factory for
HlsMediaSources. |
| Modifier and Type | Method and Description |
|---|---|
HlsMediaSource |
createMediaSource(android.net.Uri playlistUri)
Returns a new
HlsMediaSource using the current parameters. |
HlsMediaSource |
createMediaSource(android.net.Uri playlistUri,
android.os.Handler eventHandler,
com.google.android.exoplayer2.source.MediaSourceEventListener eventListener)
Deprecated.
Use
createMediaSource(Uri) and BaseMediaSource.addEventListener(Handler,
MediaSourceEventListener) instead. |
int[] |
getSupportedTypes() |
HlsMediaSource.Factory |
setAllowChunklessPreparation(boolean allowChunklessPreparation)
Sets whether chunkless preparation is allowed.
|
HlsMediaSource.Factory |
setCompositeSequenceableLoaderFactory(com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)
Sets the factory to create composite
SequenceableLoaders for when this media source
loads data from multiple streams (video, audio etc...). |
HlsMediaSource.Factory |
setExtractorFactory(HlsExtractorFactory extractorFactory)
Sets the factory for
Extractors for the segments. |
HlsMediaSource.Factory |
setMinLoadableRetryCount(int minLoadableRetryCount)
Sets the minimum number of times to retry if a loading error occurs.
|
HlsMediaSource.Factory |
setPlaylistParser(com.google.android.exoplayer2.upstream.ParsingLoadable.Parser<HlsPlaylist> playlistParser)
Sets the parser to parse HLS playlists.
|
HlsMediaSource.Factory |
setPlaylistTracker(HlsPlaylistTracker playlistTracker)
Sets the HLS playlist tracker.
|
HlsMediaSource.Factory |
setTag(java.lang.Object tag)
Sets a tag for the media source which will be published in the
Timeline of the source as Timeline.Window.tag. |
public Factory(com.google.android.exoplayer2.upstream.DataSource.Factory dataSourceFactory)
HlsMediaSources.dataSourceFactory - A data source factory that will be wrapped by a DefaultHlsDataSourceFactory to create DataSources for manifests, segments and
keys.public Factory(HlsDataSourceFactory hlsDataSourceFactory)
HlsMediaSources.hlsDataSourceFactory - An HlsDataSourceFactory for DataSources for
manifests, segments and keys.public HlsMediaSource.Factory setTag(java.lang.Object tag)
Timeline of the source as Timeline.Window.tag.tag - A tag for the media source.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setExtractorFactory(HlsExtractorFactory extractorFactory)
Extractors for the segments. The default value is HlsExtractorFactory.DEFAULT.extractorFactory - An HlsExtractorFactory for Extractors for the
segments.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setMinLoadableRetryCount(int minLoadableRetryCount)
HlsMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setPlaylistParser(com.google.android.exoplayer2.upstream.ParsingLoadable.Parser<HlsPlaylist> playlistParser)
HlsPlaylistParser.
Must not be called after calling setPlaylistTracker(com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker) on the same builder.
playlistParser - A ParsingLoadable.Parser for HLS playlists.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setPlaylistTracker(HlsPlaylistTracker playlistTracker)
DefaultHlsPlaylistTracker. Playlist trackers must not be shared by HlsMediaSource
instances.
Must not be called after calling setPlaylistParser(com.google.android.exoplayer2.upstream.ParsingLoadable.Parser<com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist>) on the same builder.
playlistTracker - A tracker for HLS playlists.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setCompositeSequenceableLoaderFactory(com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)
SequenceableLoaders for when this media source
loads data from multiple streams (video, audio etc...). The default is an instance of DefaultCompositeSequenceableLoaderFactory.compositeSequenceableLoaderFactory - A factory to create composite SequenceableLoaders for when this media source loads data from multiple streams (video,
audio etc...).java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource.Factory setAllowChunklessPreparation(boolean allowChunklessPreparation)
allowChunklessPreparation - Whether chunkless preparation is allowed.java.lang.IllegalStateException - If one of the create methods has already been called.public HlsMediaSource createMediaSource(android.net.Uri playlistUri)
HlsMediaSource using the current parameters.createMediaSource in interface com.google.android.exoplayer2.source.ads.AdsMediaSource.MediaSourceFactoryHlsMediaSource.@Deprecated public HlsMediaSource createMediaSource(android.net.Uri playlistUri, @Nullable android.os.Handler eventHandler, @Nullable com.google.android.exoplayer2.source.MediaSourceEventListener eventListener)
createMediaSource(Uri) and BaseMediaSource.addEventListener(Handler,
MediaSourceEventListener) instead.public int[] getSupportedTypes()
getSupportedTypes in interface com.google.android.exoplayer2.source.ads.AdsMediaSource.MediaSourceFactory