public final class SsDownloader extends com.google.android.exoplayer2.offline.SegmentDownloader<SsManifest,StreamKey>
Example usage:
SimpleCache cache = new SimpleCache(downloadFolder, new NoOpCacheEvictor());
DefaultHttpDataSourceFactory factory = new DefaultHttpDataSourceFactory("ExoPlayer", null);
DownloaderConstructorHelper constructorHelper =
new DownloaderConstructorHelper(cache, factory);
// Create a downloader for the first track of the first stream element.
SsDownloader ssDownloader =
new SsDownloader(
manifestUrl,
Collections.singletonList(new StreamKey(0, 0)),
constructorHelper);
// Perform the download.
ssDownloader.download();
// Access downloaded data using CacheDataSource
CacheDataSource cacheDataSource =
new CacheDataSource(cache, factory.createDataSource(), CacheDataSource.FLAG_BLOCK_ON_CACHE);
| Constructor and Description |
|---|
SsDownloader(android.net.Uri manifestUri,
java.util.List<StreamKey> streamKeys,
com.google.android.exoplayer2.offline.DownloaderConstructorHelper constructorHelper) |
| Modifier and Type | Method and Description |
|---|---|
protected SsManifest |
getManifest(com.google.android.exoplayer2.upstream.DataSource dataSource,
android.net.Uri uri) |
protected java.util.List<com.google.android.exoplayer2.offline.SegmentDownloader.Segment> |
getSegments(com.google.android.exoplayer2.upstream.DataSource dataSource,
SsManifest manifest,
boolean allowIncompleteList) |
public SsDownloader(android.net.Uri manifestUri,
java.util.List<StreamKey> streamKeys,
com.google.android.exoplayer2.offline.DownloaderConstructorHelper constructorHelper)
manifestUri - The Uri of the manifest to be downloaded.streamKeys - Keys defining which streams in the manifest should be selected for download.
If empty, all streams are downloaded.constructorHelper - A DownloaderConstructorHelper instance.protected SsManifest getManifest(com.google.android.exoplayer2.upstream.DataSource dataSource, android.net.Uri uri) throws java.io.IOException
getManifest in class com.google.android.exoplayer2.offline.SegmentDownloader<SsManifest,StreamKey>java.io.IOExceptionprotected java.util.List<com.google.android.exoplayer2.offline.SegmentDownloader.Segment> getSegments(com.google.android.exoplayer2.upstream.DataSource dataSource,
SsManifest manifest,
boolean allowIncompleteList)
getSegments in class com.google.android.exoplayer2.offline.SegmentDownloader<SsManifest,StreamKey>