From 8bf8fab1beb9296b2d3f68aa8fa0348fc36547f1 Mon Sep 17 00:00:00 2001 From: CappielloAntonio Date: Fri, 17 Sep 2021 11:05:01 +0200 Subject: [PATCH] Tried to generalize cacheDataSourceFactory to use cache for items already listened to and items already downloaded --- .../java/com/cappielloantonio/play/service/MultiPlayer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java b/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java index 9222b254..6dd247c9 100644 --- a/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java +++ b/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java @@ -96,12 +96,11 @@ public class MultiPlayer implements Playback { this.context = context; setSimpleCache(context); - // Create a read-only cache data source factory using the download cache. DataSource.Factory cacheDataSourceFactory = new CacheDataSource.Factory() .setCache(simpleCache) .setCache(DownloadUtil.getDownloadCache(context)) - .setUpstreamDataSourceFactory(DownloadUtil.getHttpDataSourceFactory(context)) - .setCacheWriteDataSinkFactory(null); // Disable writing. + .setUpstreamDataSourceFactory(DownloadUtil.getHttpDataSourceFactory(context)); + // .setCacheWriteDataSinkFactory(null); // Disable writing. AudioAttributes audioAttributes = new AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA)