2012-03-11 46 views
0

我正在使用MediaRecorder创建录制。模拟器上的Android应用程序音频录制,但不是三星

信不信由你,这个工程在模拟器上,但是当我从我的三星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(); 
+0

至于诊断,有没有什么logcat中? – 2012-03-11 19:45:08

回答

1

试试吧 -

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

这可能与您的path相关。确保预先创建了任何目录,并设置了WRITE_EXTERNAL_STORAGE权限。

相关问题