在Android上录制音频而不保存到外部存储
我正在将音频写入外部存储,但立即上传文件然后将其删除。我宁愿只获取音频数据并直接上传,而不必写入SD卡。
这是我当前的代码:
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/filename.3gp");
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
是否有任何替代我的 setOutputFile
调用,该调用将写入某种流?
I'm writing audio to external storage, but immediately uploading the file and then deleting it. I would prefer to just obtain the audio data and upload it directly, without having to write to the SD card.
Here is my current code:
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/filename.3gp");
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
Is there any replacement for my setOutputFile
call that will write to a Stream of some sort?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 Audiorecord 。
Try using Audiorecord.