Class DefaultHlsPlaylistTracker
- java.lang.Object
-
- com.google.android.exoplayer2.source.hls.playlist.DefaultHlsPlaylistTracker
-
- All Implemented Interfaces:
HlsPlaylistTracker,Loader.Callback<ParsingLoadable<HlsPlaylist>>
@Deprecated public final class DefaultHlsPlaylistTracker extends Object implements HlsPlaylistTracker, Loader.Callback<ParsingLoadable<HlsPlaylist>>
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Default implementation forHlsPlaylistTracker.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker
HlsPlaylistTracker.Factory, HlsPlaylistTracker.PlaylistEventListener, HlsPlaylistTracker.PlaylistResetException, HlsPlaylistTracker.PlaylistStuckException, HlsPlaylistTracker.PrimaryPlaylistListener
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENTDeprecated.Default coefficient applied on the target duration of a playlist to determine the amount of time after which an unchanging playlist is considered stuck.static HlsPlaylistTracker.FactoryFACTORYDeprecated.Factory forDefaultHlsPlaylistTrackerinstances.
-
Constructor Summary
Constructors Constructor Description DefaultHlsPlaylistTracker(HlsDataSourceFactory dataSourceFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistParserFactory playlistParserFactory)Deprecated.Creates an instance.DefaultHlsPlaylistTracker(HlsDataSourceFactory dataSourceFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistParserFactory playlistParserFactory, double playlistStuckTargetDurationCoefficient)Deprecated.Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddListener(HlsPlaylistTracker.PlaylistEventListener listener)Deprecated.Registers a listener to receive events from the playlist tracker.booleanexcludeMediaPlaylist(Uri playlistUrl, long exclusionDurationMs)Deprecated.Excludes the given media playlist for the given duration, in milliseconds.longgetInitialStartTimeUs()Deprecated.Returns the start time of the first loaded primary playlist, orC.TIME_UNSETif no media playlist has been loaded.HlsMultivariantPlaylistgetMultivariantPlaylist()Deprecated.Returns the multivariant playlist.HlsMediaPlaylistgetPlaylistSnapshot(Uri url, boolean isForPlayback)Deprecated.Returns the most recent snapshot available of the playlist referenced by the providedUri.booleanisLive()Deprecated.Returns whether the tracked playlists describe a live stream.booleanisSnapshotValid(Uri url)Deprecated.Returns whether the snapshot of the playlist referenced by the providedUriis valid, meaning all the segments referenced by the playlist are expected to be available.voidmaybeThrowPlaylistRefreshError(Uri url)Deprecated.If the playlist is having trouble refreshing the playlist referenced by the givenUri, this method throws the underlying error.voidmaybeThrowPrimaryPlaylistRefreshError()Deprecated.If the tracker is having trouble refreshing the multivariant playlist or the primary playlist, this method throws the underlying error.voidonLoadCanceled(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released)Deprecated.Called when a load has been canceled.voidonLoadCompleted(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs)Deprecated.Called when a load has completed.Loader.LoadErrorActiononLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount)Deprecated.Called when a load encounters an error.voidrefreshPlaylist(Uri url)Deprecated.Requests a playlist refresh and removes it from the exclusion list.voidremoveListener(HlsPlaylistTracker.PlaylistEventListener listener)Deprecated.Unregisters a listener.voidstart(Uri initialPlaylistUri, MediaSourceEventListener.EventDispatcher eventDispatcher, HlsPlaylistTracker.PrimaryPlaylistListener primaryPlaylistListener)Deprecated.Starts the playlist tracker.voidstop()Deprecated.Stops the playlist tracker and releases any acquired resources.
-
-
-
Field Detail
-
FACTORY
public static final HlsPlaylistTracker.Factory FACTORY
Deprecated.Factory forDefaultHlsPlaylistTrackerinstances.
-
DEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT
public static final double DEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT
Deprecated.Default coefficient applied on the target duration of a playlist to determine the amount of time after which an unchanging playlist is considered stuck.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultHlsPlaylistTracker
public DefaultHlsPlaylistTracker(HlsDataSourceFactory dataSourceFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistParserFactory playlistParserFactory)
Deprecated.Creates an instance.- Parameters:
dataSourceFactory- A factory forDataSourceinstances.loadErrorHandlingPolicy- TheLoadErrorHandlingPolicy.playlistParserFactory- AnHlsPlaylistParserFactory.
-
DefaultHlsPlaylistTracker
public DefaultHlsPlaylistTracker(HlsDataSourceFactory dataSourceFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistParserFactory playlistParserFactory, double playlistStuckTargetDurationCoefficient)
Deprecated.Creates an instance.- Parameters:
dataSourceFactory- A factory forDataSourceinstances.loadErrorHandlingPolicy- TheLoadErrorHandlingPolicy.playlistParserFactory- AnHlsPlaylistParserFactory.playlistStuckTargetDurationCoefficient- A coefficient to apply to the target duration of media playlists in order to determine that a non-changing playlist is stuck. Once a playlist is deemed stuck, aHlsPlaylistTracker.PlaylistStuckExceptionis thrown viamaybeThrowPlaylistRefreshError(Uri).
-
-
Method Detail
-
start
public void start(Uri initialPlaylistUri, MediaSourceEventListener.EventDispatcher eventDispatcher, HlsPlaylistTracker.PrimaryPlaylistListener primaryPlaylistListener)
Deprecated.Description copied from interface:HlsPlaylistTrackerStarts the playlist tracker.Must be called from the playback thread. A tracker may be restarted after a
HlsPlaylistTracker.stop()call.- Specified by:
startin interfaceHlsPlaylistTracker- Parameters:
initialPlaylistUri- Uri of the HLS stream. Can point to a media playlist or a multivariant playlist.eventDispatcher- A dispatcher to notify of events.primaryPlaylistListener- A callback for the primary playlist change events.
-
stop
public void stop()
Deprecated.Description copied from interface:HlsPlaylistTrackerStops the playlist tracker and releases any acquired resources.Must be called once per
HlsPlaylistTracker.start(android.net.Uri, com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher, com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.PrimaryPlaylistListener)call.- Specified by:
stopin interfaceHlsPlaylistTracker
-
addListener
public void addListener(HlsPlaylistTracker.PlaylistEventListener listener)
Deprecated.Description copied from interface:HlsPlaylistTrackerRegisters a listener to receive events from the playlist tracker.- Specified by:
addListenerin interfaceHlsPlaylistTracker- Parameters:
listener- The listener.
-
removeListener
public void removeListener(HlsPlaylistTracker.PlaylistEventListener listener)
Deprecated.Description copied from interface:HlsPlaylistTrackerUnregisters a listener.- Specified by:
removeListenerin interfaceHlsPlaylistTracker- Parameters:
listener- The listener to unregister.
-
getMultivariantPlaylist
@Nullable public HlsMultivariantPlaylist getMultivariantPlaylist()
Deprecated.Description copied from interface:HlsPlaylistTrackerReturns the multivariant playlist.If the uri passed to
HlsPlaylistTracker.start(android.net.Uri, com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher, com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.PrimaryPlaylistListener)points to a media playlist, anHlsMultivariantPlaylistwith a single variant for said media playlist is returned.- Specified by:
getMultivariantPlaylistin interfaceHlsPlaylistTracker- Returns:
- The multivariant playlist. Null if the initial playlist has yet to be loaded.
-
getPlaylistSnapshot
@Nullable public HlsMediaPlaylist getPlaylistSnapshot(Uri url, boolean isForPlayback)
Deprecated.Description copied from interface:HlsPlaylistTrackerReturns the most recent snapshot available of the playlist referenced by the providedUri.- Specified by:
getPlaylistSnapshotin interfaceHlsPlaylistTracker- Parameters:
url- TheUricorresponding to the requested media playlist.isForPlayback- Whether the caller might use the snapshot to request media segments for playback. If true, the primary playlist may be updated to the one requested.- Returns:
- The most recent snapshot of the playlist referenced by the provided
Uri. May be null if no snapshot has been loaded yet.
-
getInitialStartTimeUs
public long getInitialStartTimeUs()
Deprecated.Description copied from interface:HlsPlaylistTrackerReturns the start time of the first loaded primary playlist, orC.TIME_UNSETif no media playlist has been loaded.- Specified by:
getInitialStartTimeUsin interfaceHlsPlaylistTracker
-
isSnapshotValid
public boolean isSnapshotValid(Uri url)
Deprecated.Description copied from interface:HlsPlaylistTrackerReturns whether the snapshot of the playlist referenced by the providedUriis valid, meaning all the segments referenced by the playlist are expected to be available. If the playlist is not valid then some of the segments may no longer be available.- Specified by:
isSnapshotValidin interfaceHlsPlaylistTracker- Parameters:
url- TheUri.- Returns:
- Whether the snapshot of the playlist referenced by the provided
Uriis valid.
-
maybeThrowPrimaryPlaylistRefreshError
public void maybeThrowPrimaryPlaylistRefreshError() throws IOExceptionDeprecated.Description copied from interface:HlsPlaylistTrackerIf the tracker is having trouble refreshing the multivariant playlist or the primary playlist, this method throws the underlying error. Otherwise, does nothing.- Specified by:
maybeThrowPrimaryPlaylistRefreshErrorin interfaceHlsPlaylistTracker- Throws:
IOException- The underlying error.
-
maybeThrowPlaylistRefreshError
public void maybeThrowPlaylistRefreshError(Uri url) throws IOException
Deprecated.Description copied from interface:HlsPlaylistTrackerIf the playlist is having trouble refreshing the playlist referenced by the givenUri, this method throws the underlying error.- Specified by:
maybeThrowPlaylistRefreshErrorin interfaceHlsPlaylistTracker- Parameters:
url- TheUri.- Throws:
IOException- The underyling error.
-
refreshPlaylist
public void refreshPlaylist(Uri url)
Deprecated.Description copied from interface:HlsPlaylistTrackerRequests a playlist refresh and removes it from the exclusion list.The playlist tracker may choose to delay the playlist refresh. The request is discarded if a refresh was already pending.
- Specified by:
refreshPlaylistin interfaceHlsPlaylistTracker- Parameters:
url- TheUriof the playlist to be refreshed.
-
isLive
public boolean isLive()
Deprecated.Description copied from interface:HlsPlaylistTrackerReturns whether the tracked playlists describe a live stream.- Specified by:
isLivein interfaceHlsPlaylistTracker- Returns:
- True if the content is live. False otherwise.
-
excludeMediaPlaylist
public boolean excludeMediaPlaylist(Uri playlistUrl, long exclusionDurationMs)
Deprecated.Description copied from interface:HlsPlaylistTrackerExcludes the given media playlist for the given duration, in milliseconds.- Specified by:
excludeMediaPlaylistin interfaceHlsPlaylistTracker- Parameters:
playlistUrl- The URL of the media playlist.exclusionDurationMs- The duration for which to exclude the playlist.- Returns:
- Whether exclusion was successful.
-
onLoadCompleted
public void onLoadCompleted(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs)
Deprecated.Description copied from interface:Loader.CallbackCalled when a load has completed.Note: There is guaranteed to be a memory barrier between
Loader.Loadable.load()exiting and this callback being called.- Specified by:
onLoadCompletedin interfaceLoader.Callback<ParsingLoadable<HlsPlaylist>>- Parameters:
loadable- The loadable whose load has completed.elapsedRealtimeMs-SystemClock.elapsedRealtime()when the load ended.loadDurationMs- The duration in milliseconds of the load sinceLoader.startLoading(T, com.google.android.exoplayer2.upstream.Loader.Callback<T>, int)was called.
-
onLoadCanceled
public void onLoadCanceled(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released)
Deprecated.Description copied from interface:Loader.CallbackCalled when a load has been canceled.Note: If the
Loaderhas not been released then there is guaranteed to be a memory barrier betweenLoader.Loadable.load()exiting and this callback being called. If theLoaderhas been released then this callback may be called beforeLoader.Loadable.load()exits.- Specified by:
onLoadCanceledin interfaceLoader.Callback<ParsingLoadable<HlsPlaylist>>- Parameters:
loadable- The loadable whose load has been canceled.elapsedRealtimeMs-SystemClock.elapsedRealtime()when the load was canceled.loadDurationMs- The duration in milliseconds of the load sinceLoader.startLoading(T, com.google.android.exoplayer2.upstream.Loader.Callback<T>, int)was called up to the point at which it was canceled.released- True if the load was canceled because theLoaderwas released. False otherwise.
-
onLoadError
public Loader.LoadErrorAction onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount)
Deprecated.Description copied from interface:Loader.CallbackCalled when a load encounters an error.Note: There is guaranteed to be a memory barrier between
Loader.Loadable.load()exiting and this callback being called.- Specified by:
onLoadErrorin interfaceLoader.Callback<ParsingLoadable<HlsPlaylist>>- Parameters:
loadable- The loadable whose load has encountered an error.elapsedRealtimeMs-SystemClock.elapsedRealtime()when the error occurred.loadDurationMs- The duration in milliseconds of the load sinceLoader.startLoading(T, com.google.android.exoplayer2.upstream.Loader.Callback<T>, int)was called up to the point at which the error occurred.error- The load error.errorCount- The number of errors this load has encountered, including this one.- Returns:
- The desired error handling action. One of
Loader.RETRY,Loader.RETRY_RESET_ERROR_COUNT,Loader.DONT_RETRY,Loader.DONT_RETRY_FATALor a retry action created byLoader.createRetryAction(boolean, long).
-
-