如何附加到Android MediaRecorder输出文件 [英] How to append to Android MediaRecorder output file

查看:119
本文介绍了如何附加到Android MediaRecorder输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以告诉MediaRecorder追加到现有的音频文件,而不是从头开始.换句话说,我想用一个现有文件调用setOutputFile(),并将新的音频附加到该文件上,而不是擦除它.

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.

推荐答案

Android MediaRecorder不支持附加.

Android MediaRecorder does not support appending.

录制后,唯一可能的操作是停止并重置.

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

因此,一种选择是另存为WAV文件,然后使用AudioRecord将其附加到保存在SD卡上的现有WAV文件中. AudioRecord.read()允许将原始音频数据保存到缓冲区,您可以轻松地将其附加到现有的录音中.

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.

这篇关于如何附加到Android MediaRecorder输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆