public final class DashDownloader extends com.google.android.exoplayer2.offline.SegmentDownloader<DashManifest>
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 representation of the first adaptation set of the first
// period.
DashDownloader dashDownloader =
new DashDownloader(
manifestUrl, Collections.singletonList(new StreamKey(0, 0, 0)), constructorHelper);
// Perform the download.
dashDownloader.download();
// Access downloaded data using CacheDataSource
CacheDataSource cacheDataSource =
new CacheDataSource(cache, factory.createDataSource(), CacheDataSource.FLAG_BLOCK_ON_CACHE);
| Constructor and Description |
|---|
DashDownloader(android.net.Uri manifestUri,
java.util.List<com.google.android.exoplayer2.offline.StreamKey> streamKeys,
com.google.android.exoplayer2.offline.DownloaderConstructorHelper constructorHelper) |
| Modifier and Type | Method and Description |
|---|---|
protected DashManifest |
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,
DashManifest manifest,
boolean allowIncompleteList) |
public DashDownloader(android.net.Uri manifestUri,
java.util.List<com.google.android.exoplayer2.offline.StreamKey> streamKeys,
com.google.android.exoplayer2.offline.DownloaderConstructorHelper constructorHelper)
manifestUri - The Uri of the manifest to be downloaded.streamKeys - Keys defining which representations in the manifest should be selected for
download. If empty, all representations are downloaded.constructorHelper - A DownloaderConstructorHelper instance.protected DashManifest 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<DashManifest>java.io.IOExceptionprotected java.util.List<com.google.android.exoplayer2.offline.SegmentDownloader.Segment> getSegments(com.google.android.exoplayer2.upstream.DataSource dataSource,
DashManifest manifest,
boolean allowIncompleteList)
throws java.lang.InterruptedException,
java.io.IOException
getSegments in class com.google.android.exoplayer2.offline.SegmentDownloader<DashManifest>java.lang.InterruptedExceptionjava.io.IOException