How to append to Android MediaRecorder output file

Deadly 提交于 2019-12-24 04:36:27

问题


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:


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.



来源:https://stackoverflow.com/questions/6247402/how-to-append-to-android-mediarecorder-output-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!