Is it possible to modify the MediaRecorder source to allow pause/resume recording? I thought modifying this class was not possible, but recently I was told that it was. The question I have is, why would I want to modify MediaRecorder class and just not extend it and then write additional logic? The basic logic I would add for pausing/resuming recording would go something like this,
public void pauseRecording()
{
media_recorder.stop();
media_recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
media_recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
media_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
FileOutputStream paused_file = new FileOutputStream(file_path);
media_recorder.setOutputFile(paused_file.getFD());
}
public void resumeRecording()
{
media_recorder.prepare();
media_recorder.start();
}
The issue with this is that the preview flickers. So I have essentially three questions. Can the source code be modified directly? Is there anything wrong with my approach of extending MediaRecorder? And how can I update my pause/resume to not have the preview flicker? Thanks in advance.