I have an FFmpeg-based video-playing app which is able to play content from any arbitrary InputStream.
It is important that the app is able to play a video file which is in the process of being downloaded. What I seem to need for this is a special kind of FileInputStream that will (a) share file access with the downloading thread, and (b) if it reaches the end of the downloaded portion, will quietly block until more content becomes available.
(a) seems easy enough thanks to RandomAccessFile, but I’m a bit puzzled about (b). I can probably hack something up that will work, but I am wondering if there’s a standard approach to implementing this. Thinking about it in detail gives me a feeling that I may be missing something obvious.
Any thoughts? How would you guys do this?
I believe there is no real answer to this question. I’ve got something which works, but it looks like inelegant hacking to me. Perhaps sometimes that’s inevitable.