use of androidx.media3.datasource.cache.NoOpCacheEvictor in project media by androidx.
the class DemoUtil method getDownloadCache.
private static synchronized Cache getDownloadCache(Context context) {
if (downloadCache == null) {
File downloadContentDirectory = new File(getDownloadDirectory(context), DOWNLOAD_CONTENT_DIRECTORY);
downloadCache = new SimpleCache(downloadContentDirectory, new NoOpCacheEvictor(), getDatabaseProvider(context));
}
return downloadCache;
}
use of androidx.media3.datasource.cache.NoOpCacheEvictor in project media by androidx.
the class DashDownloaderTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
tempFolder = Util.createTempDirectory(ApplicationProvider.getApplicationContext(), "ExoPlayerTest");
cache = new SimpleCache(tempFolder, new NoOpCacheEvictor(), TestUtil.getInMemoryDatabaseProvider());
progressListener = new ProgressListener();
}
use of androidx.media3.datasource.cache.NoOpCacheEvictor in project media by androidx.
the class DashDownloadTest method setUp.
@Before
public void setUp() throws Exception {
testRunner = new DashTestRunner(TAG, testRule.getActivity()).setManifestUrl(DashTestData.H264_MANIFEST).setFullPlaybackNoSeeking(true).setCanIncludeAdditionalVideoFormats(false).setAudioVideoFormats(DashTestData.AAC_AUDIO_REPRESENTATION_ID, DashTestData.H264_CDD_FIXED);
tempFolder = Util.createTempDirectory(testRule.getActivity(), "ExoPlayerTest");
cache = new SimpleCache(tempFolder, new NoOpCacheEvictor(), new StandaloneDatabaseProvider(testRule.getActivity()));
httpDataSourceFactory = new DefaultHttpDataSource.Factory();
offlineDataSourceFactory = new CacheDataSource.Factory().setCache(cache);
}
use of androidx.media3.datasource.cache.NoOpCacheEvictor in project media by androidx.
the class CacheDataSourceTest method setUp.
@Before
public void setUp() throws Exception {
testDataUri = Uri.parse("https://www.test.com/data");
httpRequestHeaders = new HashMap<>();
httpRequestHeaders.put("Test-key", "Test-val");
unboundedDataSpec = buildDataSpec(/* unbounded= */
true, /* key= */
null);
boundedDataSpec = buildDataSpec(/* unbounded= */
false, /* key= */
null);
unboundedDataSpecWithKey = buildDataSpec(/* unbounded= */
true, DATASPEC_KEY);
boundedDataSpecWithKey = buildDataSpec(/* unbounded= */
false, DATASPEC_KEY);
defaultCacheKey = CacheKeyFactory.DEFAULT.buildCacheKey(unboundedDataSpec);
customCacheKey = "customKey." + defaultCacheKey;
cacheKeyFactory = dataSpec -> customCacheKey;
tempFolder = Util.createTempDirectory(ApplicationProvider.getApplicationContext(), "ExoPlayerTest");
cache = new SimpleCache(tempFolder, new NoOpCacheEvictor(), TestUtil.getInMemoryDatabaseProvider());
upstreamDataSource = new FakeDataSource();
}
use of androidx.media3.datasource.cache.NoOpCacheEvictor in project media by androidx.
the class CacheDataSourceTest2 method buildCacheDataSource.
private static CacheDataSource buildCacheDataSource(Context context, DataSource upstreamSource, boolean useAesEncryption) throws CacheException {
File cacheDir = context.getExternalCacheDir();
Cache cache = new SimpleCache(new File(cacheDir, EXO_CACHE_DIR), new NoOpCacheEvictor(), TestUtil.getInMemoryDatabaseProvider());
emptyCache(cache);
// Source and cipher
final String secretKey = "testKey:12345678";
DataSource file = new FileDataSource();
DataSource cacheReadDataSource = useAesEncryption ? new AesCipherDataSource(Util.getUtf8Bytes(secretKey), file) : file;
// Sink and cipher
CacheDataSink cacheSink = new CacheDataSink(cache, EXO_CACHE_MAX_FILESIZE);
byte[] scratch = new byte[3897];
DataSink cacheWriteDataSink = useAesEncryption ? new AesCipherDataSink(Util.getUtf8Bytes(secretKey), cacheSink, scratch) : cacheSink;
return new CacheDataSource(cache, upstreamSource, cacheReadDataSource, cacheWriteDataSink, CacheDataSource.FLAG_BLOCK_ON_CACHE, // eventListener
null);
}
Aggregations