繁体   English   中英

Android应用程序在模拟器上录制音频但不在三星上录制

[英]Android application audio recording on emulator but not on Samsung

我正在使用MediaRecorder创建录音。

信不信由你,这可以在模拟器上运行,但是当我从三星Galaxy S2运行它时,它不会记录(或者如果它,它不会播放!)

(看起来像其他人报告的相反问题 - 仿真器不起作用)

我该如何诊断并修复它?

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path.getAbsolutePath());
recorder.prepare();
recorder.start();

试试吧 -

mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setOutputFile("/mnt/sdcard/audio.amr");

它可能与你的path有关。 确保事先创建了任何目录,并设置了WRITE_EXTERNAL_STORAGE权限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM