【问题标题】:Android Kotlin - How to use ExoPlayer SimpleCache as of todayAndroid Kotlin - 从今天开始如何使用 ExoPlayer SimpleCache
【发布时间】:2022-01-05 15:06:56
【问题描述】:

到目前为止,我只发现了不推荐使用的东西:

val evictor = LeastRecentlyUsedCacheEvictor((100 * 1024 * 1024).toLong())
val databaseProvider: DatabaseProvider = ExoDatabaseProvider(context)

val simpleCache = SimpleCache(File(context.cacheDir, "media"), evictor, databaseProvider)

val mediaSource = ProgressiveMediaSource.Factory(
    simpleCache?.let {
        CacheDataSourceFactory(
            context,
            100 * 1024 * 1024, 10 * 1024 * 1024, fileUrl, it
        )
    }
).createMediaSource(fileUrl)

player.prepare(mediaSource)

ExoDatabaseProvider 已弃用,CacheDataSourceFactory 是未解析的引用

【问题讨论】:

    标签: android kotlin exoplayer exoplayer2.x


    【解决方案1】:

    使用CacheDataSource.Factory() 代替CacheDataSourceFactoryStandaloneDatabaseProvider 代替ExoDatabaseProvider

    【讨论】:

    • 没有视频以这种方式显示
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 2021-12-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多