danikula / danikula/AndroidVideoCache
Not all videos that are being cached
- Dominant language
- Java
- Stars
- 5.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I have a list of videos which is try to cache but somehow only the first few videos are being cached.
urls.map {
proxy.registerCacheListener(listener, it)
uriList.add(Uri.parse(proxy.getProxyUrl(it)))
}
val mediaSource = createConcatenatedMediaSource(uriList)
player.prepare(mediaSource, true, false)
This is how the proxyCache Server is being created in the Application file
HttpProxyCacheServer.Builder(this)
.maxCacheSize(1024 * 1024 * 1024)
.cacheDirectory(VideoCacheUtils.getVideoCacheDir(this))
.build()
Here is how I create the media source
private fun createConcatenatedMediaSource(uriList: List): MediaSource {
val mediaList: ArrayList = ArrayList()
uriList.map {
mediaList.add(createMediaSource(it))
}
return ConcatenatingMediaSource(*mediaList.toTypedArray())
}
private fun createMediaSource(uri: Uri): MediaSource {
val bandwidthMeter = DefaultBandwidthMeter()
val dataSourceFactory = DefaultDataSourceFactory(context, Util.getUserAgent(context, "exoplayer-videos"), bandwidthMeter)
return ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(uri)
}
And here is how i create the exo player
val videoTrackSelectionFactory = AdaptiveTrackSelection.Factory()
val trackSelector = DefaultTrackSelector(videoTrackSelectionFactory)
player = ExoPlayerFactory.newSimpleInstance(context,
DefaultRenderersFactory(context),
trackSelector,
DefaultLoadControl())
I checked the mediaSource. All of the videos are in the list.
**I tried making the cache size bigger but that didn't fix the problem.**
**I tried making the cache size smaller to see if fewer videos will be cached, the number didn't change. SO obviously even 512 MB is enough for the videos that are being cached. Why would 1GB not be enough for the rest of it.**
How do I increase the number of videos cached?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.