4
我發現代碼記錄,但我總是得到:Android的錄音
在類型MediaRecorder的方法setOutputFile(的FileDescriptor)不適用於參數(URI)
因此,如何將我需要描述它工作的文件路徑? THX
// Prepare recorder source and type
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
// File to which audio should be recorded
File outputFile = getFileStreamPath("output.amr");
Uri target = Uri.parse(outputFile.getAbsolutePath());
recorder.setOutputFile(target);
// Get ready!
recorder.prepare();
// Start recording
recorder.start();
// Stop and tidy up
recorder.stop();
recorder.release();
thx,多數民衆贊成它:) – 2010-08-23 20:19:11