I’m muxing an audio and video file. I have the urls where both files are hosted. I use android.media.MediaMuxer and android.media.MediaExtractor to mux them. During this muxing, those classes download the files, but I want to show progress, so I need to know the total file size of the audio file and the video files.
Does anyone know how to get the file size using those Android API’s? Or do I have to just hit the URL’s myself (again) to get the content length?
Example files
In the end I did a HEAD request to get the "content-length" header (which gives me the file size), before handing off to MediaExtractor.
I've realised now I could also have downloaded the file myself, then get a local FileDescriptor
and pass that to MediaExtractor
allowing me to avoid extra network requests.