Override ProgressiveMediaSource to update file before play
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have a question abuot a good path to acquire this functionality.
I am dynamically downloading MP4 file to local directory which is then used as a ExoPlayer MediaSource. This MediaSource is then played by ExoPlayer in continous loop.
This file is being updated every hour by a different thread and new copy is download and then stored near the current playing one with a .tmp extension.
What functionality i want to achieve is when current MP4 play ends, i want to have a chance to rename file.mp4.tmp to file.mp4 so the new downloaded copy can get playing.
Scenario:
1. file.mp4 plays (length 10 minutes) in a loop
2. New copy of file.mp4 is downloaded and stored as file.mp4.tmp
3. When file.mp4 reaches EOF, rename file.mp4.tmp to file.mp4
4. Play file.mp4 in a loop again
5. Goto :1
I checked that MediaSource is Final so i cannot override it.
Qeustion is - how is the best minimalistic way to glue into code to get a chance to hit the moment when ExoPlayer closes current file and tries to reopen it so i can make a simple f.renameTo().
I already have ConcatenatingMediaSource which i am using, but this path needs to reorder whole playlist which i don't want to do.
Contributor guide
Assessment
This issue has not been assessed yet.