Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video caching not working as intended? #9980

Closed
zozo11299 opened this issue Feb 15, 2022 · 4 comments
Closed

Video caching not working as intended? #9980

zozo11299 opened this issue Feb 15, 2022 · 4 comments

Comments

@zozo11299
Copy link

Hello team so this is a semi question semi report for the feature video caching

I was using exoplayer to watch a 300 mb online video, I purposely paused the video for around 10 minutes so it can cache the video, I have the cache limit to 500 mb so it was clearly enough for all sorts of caching within the video, problem is after I came back 10 minutes, only around half a minute of a 23 minute video being cached why would this happen?

Note that both my internet and storage were more then enough

So I would like to know why this is happening, maybe it's how the feature works so I would like to know (it happens all the time it's not a one time thing)

@icbaker
Copy link
Collaborator

icbaker commented Feb 17, 2022

Please provide more information. How are you configuring the "cache limit to 500 mb"?

Note that DefaultLoadControl will aim to buffer a maximum of 50s and 131MB of video by default.

When you pause playback, the player won't automatically try and load any media beyond the limit enforced by the LoadControl (either into the in-memory buffer or any persistent storage).

We have an open feature request to support concurrent playback and downloading - depending on exactly what you're trying to do, this issue may be a duplicate of that: #8645

@LagradOst
Copy link

LagradOst commented Feb 18, 2022

(I think) He is referring to a CacheDataSource.setCache of a SimpleCache with LeastRecentlyUsedCacheEvictor of 500mb. Is this implementation of cache wrong to reduce buffering? Do exoplayer require additional calls to ensure that it can cache 500mb of video when paused?

@icbaker
Copy link
Collaborator

icbaker commented Feb 23, 2022

There's two different concepts that it's important to understand here:

  • buffering
  • downloading/caching

ExoPlayer uses 'buffering' to refer to reading data into memory as part of a normal playback. The amount of data buffered is controlled by the LoadControl. As described above, the DefaultLoadControl will read up to 50s ahead of the playback position.

'Downloading' or 'caching' refers to persisting media content to disk (not memory). This can happen as part of normal playback (if you just include a CacheDataSource in your DataSource chain) or you can use ExoPlayer's download components to explicitly download content outside of a playback context.

If you're using a CacheDataSource during normal playback (without using any download components), then this will only cache data (to disk) that is buffered (to memory) as part of that normal playback. If you pause the player, the buffering (and therefore caching) will also pause - because it will reach that point 50s ahead of the playback position as influenced by the LoadControl.

If you want to leave the player paused and download the entire stream onto disk (but not memory), then I think that will be possible once #8645 is implemented - but is currently unsupported.

@zozo11299
Copy link
Author

Thanks for feed back I found what I want

@google google locked and limited conversation to collaborators May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants