diff --git a/kohii-exoplayer/build.gradle b/kohii-exoplayer/build.gradle index c4a36094..71f46f5c 100644 --- a/kohii-exoplayer/build.gradle +++ b/kohii-exoplayer/build.gradle @@ -17,8 +17,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion libs.versions.android.target.sdk.get().toInteger() - defaultConfig { minSdkVersion libs.versions.android.min.sdk.get() targetSdkVersion libs.versions.android.target.sdk.get() diff --git a/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerConfig.kt b/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerConfig.kt index 80d07d12..0da7c52e 100644 --- a/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerConfig.kt +++ b/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerConfig.kt @@ -133,15 +133,16 @@ fun ExoPlayerConfig.createDefaultPlayerPool( context: Context, userAgent: String ) = ExoPlayerPool( - context = context.applicationContext, - userAgent = userAgent, - clock = clock, - bandwidthMeterFactory = this, - trackSelectorFactory = this, - loadControlFactory = this, - renderersFactory = DefaultRenderersFactory(context.applicationContext) - .setEnableDecoderFallback(enableDecoderFallback) - .setAllowedVideoJoiningTimeMs(allowedVideoJoiningTimeMs) - .setExtensionRendererMode(extensionRendererMode) - .setMediaCodecSelector(mediaCodecSelector) + context = context.applicationContext, + userAgent = userAgent, + clock = clock, + bandwidthMeterFactory = this, + trackSelectorFactory = this, + loadControlFactory = this, + renderersFactory = DefaultRenderersFactory(context.applicationContext) + .setEnableDecoderFallback(enableDecoderFallback) + .setAllowedVideoJoiningTimeMs(allowedVideoJoiningTimeMs) + .setExtensionRendererMode(extensionRendererMode) + .setMediaCodecSelector(mediaCodecSelector), + cache = cache, ) diff --git a/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerPool.kt b/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerPool.kt index c6e88e43..5bcf26b3 100644 --- a/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerPool.kt +++ b/kohii-exoplayer/src/main/java/kohii/v1/exoplayer/ExoPlayerPool.kt @@ -51,6 +51,7 @@ class ExoPlayerPool( private val loadControlFactory: LoadControlFactory = ExoPlayerConfig.DEFAULT, private val renderersFactory: RenderersFactory = DefaultRenderersFactory(context.applicationContext), + private val cache: Cache? = null, // DefaultMediaSourceFactory // @RestrictTo(LIBRARY_GROUP) // Note: Only used within the library group. Client must not access this field. @@ -58,7 +59,7 @@ class ExoPlayerPool( val httpDataSource = DefaultHttpDataSource.Factory().setUserAgent(userAgent) // DefaultMediaSourceFactory - val mediaCache: Cache = ExoPlayerCache.lruCacheSingleton.get(context) + val mediaCache: Cache = cache ?: ExoPlayerCache.lruCacheSingleton.get(context) val upstreamFactory = DefaultDataSource.Factory(context, httpDataSource) val drmSessionManagerProvider = DefaultDrmSessionManagerProvider() drmSessionManagerProvider.setDrmHttpDataSourceFactory(httpDataSource)