How to append to Android MediaRecorder output file

2019-07-11 02:45发布

I am wondering if there is a way to tell the MediaRecorder to append to an existing audio file instead of starting it over from the beginning. In other words, I would like to call setOutputFile() with an existing file and have the new audio appended to that file instead of erasing it.

1条回答
\"骚年 ilove
2楼-- · 2019-07-11 03:06

Android MediaRecorder does not support appending.

Once you are recording the only possible actions are stop and reset.

So one option is saving as a WAV file, and then append to an existing WAV file saved on the SD card using AudioRecord instead. AudioRecord.read() allows one to save the raw audiodata to a buffer, which you could easily append to an existing recording.

查看更多
登录 后发表回答