Reputation: 76564
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
Video url: https://v.redd.it/832kzf6e23h71/DASH_1080.mp4
Audio url: https://v.redd.it/832kzf6e23h71/DASH_audio.mp4
Upvotes: 1
Views: 196
Reputation: 76564
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.
Upvotes: 1