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

Android ExoPlayer cache #1148

Conversation

RalfNieuwenhuizen
Copy link
Contributor

@RalfNieuwenhuizen RalfNieuwenhuizen commented Jul 26, 2018

Basic implementation of ExoPlayer cache.

What is does is load the media into a SimpleCache at the apps cache directory "/video", which can be read by the ExoPlayer.
The exportVideo method is meant for extracting a video file from the cache as an mp4 file, for example when you want to save it to the camera roll.

In order to make this work I have updated ExoPlayer to 2.8.2 which included breaking changes for setSelectedTextTrack.

TODO's:

  • Fix setSelectedTextTrack
  • Maintain a maximum cache size
  • Test on larger files
  • Test exportVideo

@RalfNieuwenhuizen RalfNieuwenhuizen mentioned this pull request Jul 26, 2018
2 tasks
@n1ru4l
Copy link
Contributor

n1ru4l commented Jul 26, 2018

@RalfNieuwenhuizen What about cache size and max file size?

@RalfNieuwenhuizen
Copy link
Contributor Author

@n1ru4l good point. I've added this to the list of TODO's. For max file size I haven't seen any issues yet while testing with https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

@n1ru4l
Copy link
Contributor

n1ru4l commented Jul 26, 2018

@RalfNieuwenhuizen I actually wanted to write maximum allowed files to be in the cache 😅.

@cobarx
Copy link
Contributor

cobarx commented Jul 31, 2018

I'd like to split the ExoPlayer update out into a separate PR. I would have done the upgrade sooner but ran into issues where it wanted to added an additional dependency on the support library or something like that.

If you want to create a new PR for the upgrade, I can take care of getting the text track code updated.

@RalfNieuwenhuizen RalfNieuwenhuizen force-pushed the android-exoplayer-caching branch from b4f3a7d to 941ecc0 Compare August 1, 2018 06:55
@RalfNieuwenhuizen
Copy link
Contributor Author

@cobarx ah, turns out the update isn't necessary at all, since I'm not using DownloadService / DownloadManager anymore. Fixed in PR!

@djw27
Copy link

djw27 commented Aug 7, 2018

@RalfNieuwenhuizen I haven't looked into the details yet, but are you planning on supporting caching of HLS videos?

@cobarx
Copy link
Contributor

cobarx commented Aug 8, 2018

@RalfNieuwenhuizen I wanted to give you a heads up that I merged the ExoPlayer 2.8.2 update (#1170) in case you want to use any of that stuff. I took care of the text track support.

Edit: add PR link

@alizbazar
Copy link

alizbazar commented Jul 27, 2019

What are the blockers for this to be merged? Would love to get caching support for Android, too!

@CHaNGeTe
Copy link
Contributor

@alizbazar It has a list of TODOs so I guess that's the reason

@benoitdion benoitdion mentioned this pull request Feb 17, 2020
@cstranex
Copy link

Any word on this being completed?

@surethink
Copy link

when will this be merged? need it very much

@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue.

@stale stale bot added the stale Closed due to inactivity or lack or resources label Apr 19, 2022
@hueniverse hueniverse removed the stale Closed due to inactivity or lack or resources label Apr 20, 2022
RalfNieuwenhuizen and others added 9 commits April 20, 2022 11:07
* Return bytes read and written in export video method

* Cleanup unused vars
…p#31)

* Store exo player cache in subdirectory

* Let exo player fully manage cache size

* Restrict cache size to 380MB

* Make cache evictor configurable

* Make sub cache directory configurable

* Use correct type
@RalfNieuwenhuizen
Copy link
Contributor Author

@hueniverse I have added some commits that help support a maximum cache size. That's all we have for now. Is this PR something you'd like to pick up?

@hueniverse
Copy link
Contributor

@RalfNieuwenhuizen Much appreciated! Can you explain the items left on the TODO list above? Would you be able to update the documentation for this feature? Is it on by default or only enabled if manually configured?

@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Apr 22, 2022
@hueniverse hueniverse closed this Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.