How can I check video file size while recording using MediaRecorder? And when max file size reached - automatically start recording new video to new file?
Thanks, Michael
You can check the file size with:
public long getFileSize(String filepath) {
File file = new File(filepath);
if (file.exists())
return file.length();
else
return 0;
}
Call this inside an AsyncTask or Timer, depending on what you want to do with the information, to periodically check the file size and stop the recording and start it again if the max file size is almost reached.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With