I use MediaRecorder API before Oreo. The problem I am facing is that the recording happens on one continuation of a large file if the recording lasts 1 or 2 hours.
Since Oreo (API level 26), the MediaRecorder API introduced setNextOutputFile () , which can be useful for writing across multiple files without data loss. These files can be configured to small sizes, so when processing they do not take up a lot of application memory.
My plan is to use them as follows:
File current;
File nextFile;
.
.
.
mRecorder.setOutputFile(currentFileName);
mRecorder.prepare();
mRecorder.setNextOutputFile(nextFile);
.
.
mRecorder.start();
.
.
mRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {
@Override
public void onInfo(MediaRecorder mr, int infoCode, int extra) {
Log.e(TAG, "Media recorder info : " + infoCode);
if (infoCode == MediaRecorder.MEDIA_RECORDER_INFO_NEXT_OUTPUT_FILE_STARTED) {
String path = getNewUniquePath();
File nextFile = new File(path);
mRecorder.setNextOutputFile(nextFile);
}
}
});
.
.
.
, 1 2 , .
, Oreo, API.
, Android?
?