docs/doc/reference/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistTracker.html
Package com.google.android.exoplayer2.source.hls.playlist
DefaultHlsPlaylistTracker[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceHlsPlaylistTracker
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.
Tracks playlists associated to an HLS stream and provides snapshots.
The playlist tracker is responsible for exposing the seeking window, which is defined by the segments that one of the playlists exposes. This playlist is called primary and needs to be periodically refreshed in the case of live streams. Note that the primary playlist is one of the media playlists while the multivariant playlist is an optional kind of playlist defined by the HLS specification (RFC 8216).
Playlist loads might encounter errors. The tracker may choose to exclude them to ensure a primary playlist is always available.
Nested Classes | Modifier and Type | Interface | Description |
| --- | --- | --- |
| static interface | HlsPlaylistTracker.Factory |
Deprecated.
Factory for HlsPlaylistTracker instances.
|
| static interface | HlsPlaylistTracker.PlaylistEventListener |
Deprecated.
Called on playlist loading events.
|
| static class | HlsPlaylistTracker.PlaylistResetException |
Deprecated.
Thrown when the media sequence of a new snapshot indicates the server has reset.
|
| static class | HlsPlaylistTracker.PlaylistStuckException |
Deprecated.
Thrown when a playlist is considered to be stuck due to a server side error.
|
| static interface | HlsPlaylistTracker.PrimaryPlaylistListener |
Deprecated.
Listener for primary playlist changes. |
All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | addListener(HlsPlaylistTracker.PlaylistEventListener listener) |
Deprecated.
Registers a listener to receive events from the playlist tracker.
|
| boolean | excludeMediaPlaylist(Uri playlistUrl, long exclusionDurationMs) |
Deprecated.
Excludes the given media playlist for the given duration, in milliseconds.
|
| long | getInitialStartTimeUs() |
Deprecated.
Returns the start time of the first loaded primary playlist, or C.TIME_UNSET if no media playlist has been loaded.
|
| HlsMultivariantPlaylist | getMultivariantPlaylist() |
Deprecated.
Returns the multivariant playlist.
|
| HlsMediaPlaylist | getPlaylistSnapshot(Uri url, boolean isForPlayback) |
Deprecated.
Returns the most recent snapshot available of the playlist referenced by the provided Uri.
|
| boolean | isLive() |
Deprecated.
Returns whether the tracked playlists describe a live stream.
|
| boolean | isSnapshotValid(Uri url) |
Deprecated.
Returns whether the snapshot of the playlist referenced by the provided Uri is valid, meaning all the segments referenced by the playlist are expected to be available.
|
| void | maybeThrowPlaylistRefreshError(Uri url) |
Deprecated.
If the playlist is having trouble refreshing the playlist referenced by the given Uri, this method throws the underlying error.
|
| void | maybeThrowPrimaryPlaylistRefreshError() |
Deprecated.
If the tracker is having trouble refreshing the multivariant playlist or the primary playlist, this method throws the underlying error.
|
| void | refreshPlaylist(Uri url) |
Deprecated.
Requests a playlist refresh and removes it from the exclusion list.
|
| void | removeListener(HlsPlaylistTracker.PlaylistEventListener listener) |
Deprecated.
Unregisters a listener.
|
| void | start(Uri initialPlaylistUri, MediaSourceEventListener.EventDispatcher eventDispatcher, HlsPlaylistTracker.PrimaryPlaylistListener primaryPlaylistListener) |
Deprecated.
Starts the playlist tracker.
|
| void | stop() |
Deprecated.
Stops the playlist tracker and releases any acquired resources. |
-
void start([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")initialPlaylistUri,[MediaSourceEventListener.EventDispatcher](../../MediaSourceEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.source")eventDispatcher,[HlsPlaylistTracker.PrimaryPlaylistListener](HlsPlaylistTracker.PrimaryPlaylistListener.html "interface in com.google.android.exoplayer2.source.hls.playlist")primaryPlaylistListener)
Deprecated.
Starts the playlist tracker.
Must be called from the playback thread. A tracker may be restarted after a stop() call.
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.
-
void stop()
Deprecated.
Stops the playlist tracker and releases any acquired resources.
Must be called once per start(android.net.Uri, com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher, com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.PrimaryPlaylistListener) call.
-
void addListener([HlsPlaylistTracker.PlaylistEventListener](HlsPlaylistTracker.PlaylistEventListener.html "interface in com.google.android.exoplayer2.source.hls.playlist")listener)
Deprecated.
Registers a listener to receive events from the playlist tracker.
Parameters:listener - The listener.
-
void removeListener([HlsPlaylistTracker.PlaylistEventListener](HlsPlaylistTracker.PlaylistEventListener.html "interface in com.google.android.exoplayer2.source.hls.playlist")listener)
Deprecated.
Unregisters a listener.
Parameters:listener - The listener to unregister.
-
@Nullable[HlsMultivariantPlaylist](HlsMultivariantPlaylist.html "class in com.google.android.exoplayer2.source.hls.playlist")getMultivariantPlaylist()
Deprecated.
Returns the multivariant playlist.
If the uri passed to 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, an HlsMultivariantPlaylist with a single variant for said media playlist is returned.
Returns:The multivariant playlist. Null if the initial playlist has yet to be loaded.
-
@Nullable[HlsMediaPlaylist](HlsMediaPlaylist.html "class in com.google.android.exoplayer2.source.hls.playlist")getPlaylistSnapshot([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")url,
boolean isForPlayback)
Deprecated.
Returns the most recent snapshot available of the playlist referenced by the provided Uri.
Parameters:url - The Uri corresponding 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.
-
long getInitialStartTimeUs()
Deprecated.
Returns the start time of the first loaded primary playlist, or C.TIME_UNSET if no media playlist has been loaded.
-
boolean isSnapshotValid([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")url)
Deprecated.
Returns whether the snapshot of the playlist referenced by the provided Uri is 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.
Parameters:url - The Uri.Returns:Whether the snapshot of the playlist referenced by the provided Uri is valid.
-
void maybeThrowPrimaryPlaylistRefreshError()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
If the tracker is having trouble refreshing the multivariant playlist or the primary playlist, this method throws the underlying error. Otherwise, does nothing.
Throws:IOException - The underlying error.
-
void maybeThrowPlaylistRefreshError([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")url)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
If the playlist is having trouble refreshing the playlist referenced by the given Uri, this method throws the underlying error.
Parameters:url - The Uri.Throws:IOException - The underyling error.
-
boolean excludeMediaPlaylist([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")playlistUrl,
long exclusionDurationMs)
Deprecated.
Excludes the given media playlist for the given duration, in milliseconds.
Parameters:playlistUrl - The URL of the media playlist.exclusionDurationMs - The duration for which to exclude the playlist.Returns:Whether exclusion was successful.
-
void refreshPlaylist([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")url)
Deprecated.
Requests 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.
Parameters:url - The Uri of the playlist to be refreshed.
-
boolean isLive()
Deprecated.
Returns whether the tracked playlists describe a live stream. Returns:True if the content is live. False otherwise.