use of androidx.media3.exoplayer.offline.Downloader in project media by androidx.
the class SsDownloaderTest method createWithDefaultDownloaderFactory.
@Test
public void createWithDefaultDownloaderFactory() throws Exception {
CacheDataSource.Factory cacheDataSourceFactory = new CacheDataSource.Factory().setCache(Mockito.mock(Cache.class)).setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
DownloaderFactory factory = new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */
Runnable::run);
Downloader downloader = factory.createDownloader(new DownloadRequest.Builder(/* id= */
"id", Uri.parse("https://www.test.com/download")).setMimeType(MimeTypes.APPLICATION_SS).setStreamKeys(Collections.singletonList(new StreamKey(/* groupIndex= */
0, /* trackIndex= */
0))).build());
assertThat(downloader).isInstanceOf(SsDownloader.class);
}
use of androidx.media3.exoplayer.offline.Downloader in project media by androidx.
the class DashDownloaderTest method createWithDefaultDownloaderFactory.
@Test
public void createWithDefaultDownloaderFactory() {
CacheDataSource.Factory cacheDataSourceFactory = new CacheDataSource.Factory().setCache(Mockito.mock(Cache.class)).setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
DownloaderFactory factory = new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */
Runnable::run);
Downloader downloader = factory.createDownloader(new DownloadRequest.Builder(/* id= */
"id", Uri.parse("https://www.test.com/download")).setMimeType(MimeTypes.APPLICATION_MPD).setStreamKeys(Collections.singletonList(new StreamKey(/* groupIndex= */
0, /* trackIndex= */
0))).build());
assertThat(downloader).isInstanceOf(DashDownloader.class);
}
use of androidx.media3.exoplayer.offline.Downloader in project media by androidx.
the class HlsDownloaderTest method downloadEncMediaPlaylist.
@Test
public void downloadEncMediaPlaylist() throws Exception {
fakeDataSet = new FakeDataSet().setData(ENC_MEDIA_PLAYLIST_URI, ENC_MEDIA_PLAYLIST_DATA).setRandomData("enc.key", 8).setRandomData("enc2.key", 9).setRandomData("fileSequence0.ts", 10).setRandomData("fileSequence1.ts", 11).setRandomData("fileSequence2.ts", 12);
HlsDownloader downloader = getHlsDownloader(ENC_MEDIA_PLAYLIST_URI, getKeys());
downloader.download(progressListener);
assertCachedData(cache, fakeDataSet);
}
Aggregations