diff --git a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/datasource/CacheKeyAesCipherDataSourceFactoryFactory.kt b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/datasource/CacheKeyAesCipherDataSourceFactoryFactory.kt index f6ab215c..fd260a48 100644 --- a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/datasource/CacheKeyAesCipherDataSourceFactoryFactory.kt +++ b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/datasource/CacheKeyAesCipherDataSourceFactoryFactory.kt @@ -15,6 +15,7 @@ internal class CacheKeyAesCipherDataSourceFactoryFactory( fun create(cache: Cache) = CacheKeyAesCipherDataSourceFactory( cacheKeyFactory, encryption!!.secretKey, - cacheDataSourceFactory.setCache(cache), + cacheDataSourceFactory.setCache(cache) + .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR), ) } diff --git a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelper.kt b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelper.kt index 07ad2449..6bba727e 100644 --- a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelper.kt +++ b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelper.kt @@ -17,4 +17,5 @@ internal class OfflinePlayDrmDataSourceFactoryHelper( ) : OfflineDataSourceFactoryHelper(offlineCacheProvider) { override fun create(cache: Cache) = cacheDataSourceFactory.setCache(cache) + .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) } diff --git a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/player/di/MediaSourcererModule.kt b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/player/di/MediaSourcererModule.kt index 93ffd1fb..68ac47bd 100644 --- a/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/player/di/MediaSourcererModule.kt +++ b/player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/player/di/MediaSourcererModule.kt @@ -158,6 +158,7 @@ internal object MediaSourcererModule { .setUpstreamDataSourceFactory(okHttpDataSourceFactory) .setCacheReadDataSourceFactory(fileDataSourceFactory) .setCacheWriteDataSinkFactory(cacheDataSinkFactory) + .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) } @Provides diff --git a/player/playback-engine/src/test/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelperTest.kt b/player/playback-engine/src/test/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelperTest.kt index e867f683..3eebc2b0 100644 --- a/player/playback-engine/src/test/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelperTest.kt +++ b/player/playback-engine/src/test/kotlin/com/tidal/sdk/player/playbackengine/offline/OfflinePlayDrmDataSourceFactoryHelperTest.kt @@ -31,11 +31,14 @@ internal class OfflinePlayDrmDataSourceFactoryHelperTest { fun create() { val cache = mock() whenever(cacheDataSourceFactory.setCache(cache)).thenReturn(cacheDataSourceFactory) + whenever(cacheDataSourceFactory.setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)) + .thenReturn(cacheDataSourceFactory) val actualDataSourceFactory = offlinePlayDrmDataSourceFactoryHelper.create(cache) assertThat(actualDataSourceFactory).isSameAs(cacheDataSourceFactory) verify(cacheDataSourceFactory).setCache(cache) + verify(cacheDataSourceFactory).setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) verifyNoMoreInteractions( cache, cacheDataSourceFactory,