public final class HlsDownloadHelper extends DownloadHelper
DownloadHelper
for HLS streams.DownloadHelper.Callback
Constructor and Description |
---|
HlsDownloadHelper(Uri uri,
DataSource.Factory manifestDataSourceFactory) |
Modifier and Type | Method and Description |
---|---|
HlsDownloadAction |
getDownloadAction(byte[] data,
List<TrackKey> trackKeys)
Builds a
DownloadAction for downloading the specified tracks. |
int |
getPeriodCount()
Returns the number of periods for which media is available.
|
HlsPlaylist |
getPlaylist()
Returns the HLS playlist.
|
HlsDownloadAction |
getRemoveAction(byte[] data)
Builds a
DownloadAction for removing the media. |
TrackGroupArray |
getTrackGroups(int periodIndex)
Returns the track groups for the given period.
|
protected void |
prepareInternal()
Called on a background thread during preparation.
|
prepare
public HlsDownloadHelper(Uri uri, DataSource.Factory manifestDataSourceFactory)
protected void prepareInternal() throws IOException
DownloadHelper
prepareInternal
in class DownloadHelper
IOException
- If preparation fails.public HlsPlaylist getPlaylist()
public int getPeriodCount()
DownloadHelper
getPeriodCount
in class DownloadHelper
public TrackGroupArray getTrackGroups(int periodIndex)
DownloadHelper
getTrackGroups
in class DownloadHelper
periodIndex
- The period index.TrackGroupArray.EMPTY
for single stream
content.public HlsDownloadAction getDownloadAction(@Nullable byte[] data, List<TrackKey> trackKeys)
DownloadHelper
DownloadAction
for downloading the specified tracks. Must not be called until
after preparation completes.getDownloadAction
in class DownloadHelper
data
- Application provided data to store in DownloadAction.data
.trackKeys
- The selected tracks. If empty, all streams will be downloaded.DownloadAction
.public HlsDownloadAction getRemoveAction(@Nullable byte[] data)
DownloadHelper
DownloadAction
for removing the media. May be called in any state.getRemoveAction
in class DownloadHelper
data
- Application provided data to store in DownloadAction.data
.DownloadAction
.