6
我在錄製Android棒棒糖和更高版本的語音通話時出現問題。通過此代碼,我可以錄製我的聲音,但無法錄製其他人的聲音。Android上的語音通話錄音棒棒糖和更高版本無法正常工作
public void startRecording() {
if (recording == false) {
Log.e("here", "--------Recorder_Sarted------" + fname);
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy");
int randomPIN = (int) (Math.random() * 9000) + 1000;
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
String file = Environment.getExternalStorageDirectory().toString();
String filepath = file + "/Aeris/Recording";
File dir = new File(filepath);
dir.mkdirs();
Log.e("here ", "----------------" + sdf.format(Calendar.getInstance().getTime()) + " " + fname + " " + type);
filepath += "/" + type + "-" + fname + "-" + sdf.format(Calendar.getInstance().getTime()) + "-" + randomPIN + ".3gp";
recorder.setOutputFile(filepath);
try {
recorder.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
recorder.start();
recording = true;
}
}
此代碼在Android棒棒糖版本下工作正常。 請幫我解決這個問題