Continue buffering while in pause
Hi!
Currently when player is paused it stops to receive new data in buffer. Is it possible to continue buffering while player is in pause state?
If there is no other options, guess, I could use Cache feature to save data in separate thread and then use cached data to play when it is buffered enough while in pause. If it is the case, could you please explain should I use Downloader to save data in one thread and then use another Cache with the link to the same DataSpec or can I use the same Cache instance in another thread for playback?
Thanks!
For the second part of the question, it's an error to create two Cache instances which store cache files on the same folder. It's OK to access to a single instance of Cache from different threads but there are issues with writing and reading the same content on the cache. In your case as long as you stop the downloader before player resumes it should be fine.
For the first part of the question: We don't stop buffering when the player is paused. We stop buffering when the criteria for how much media should be buffered is reached, which is independent of whether the player is paused or not. You can customize how much media is buffered by instantiating a DefaultLoadControl using one of the constructors that allows specifying minimum and maximum buffer durations, and then passing that instance into a ExoPlayerFactory when instantiating the player. You can also implement your own LoadControl from scratch if that's easier.
Note that LoadControl controls buffering in RAM, so there's only so far you can go before you'll end up with your process crashing with an out of memory error. If you want to buffer to disk then you should use the cache feature instead.
Thanks for your replies! Very useful.