2012-03-11 84 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權限。

相關問題