在我的应用程序中,有一项功能可以录制语音通话,而且效果非常好。但是当测试(三星s7,s8)它不能很好地工作。该应用程序只能记录来电者的声音而不是另一端的声音。以下是我要检查的代码,请提出解决方案
MediaRecd = new MediaRecorder();
MediaRecd.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL
);
MediaRecd.setAudioChannels(ConstantVariables.audioChannels);//monoRecording
MediaRecd.setAudioEncodingBitRate(64);
MediaRecd.setAudioSamplingRate(44100);
MediaRecd.setOutputFormat(output_formats[pos]);//.mp3
MediaRecd.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);//I already try with all possible CAMCORDER , MIC , Default etc etc but none was working
MediaRecd.setOutputFile(Currentfilename);
try {
MediaRecd.prepare();
MediaRecd.start();
} catch (Exception e) {
MediaRecd.reset();
MediaRecd.release();
MediaRecd = null;
}
请帮忙
答案 0 :(得分:-1)
AudioSource.VOICE_CALL
在某些Android设备中无效
而不是VOICE_CALL
使用
首先尝试MediaRecorder.AudioSource.CAMCORDER
MediaRecd = new MediaRecorder();
MediaRecd.setAudioSource(MediaRecorder.AudioSource.CAMCORDER
);
如果上述方法不起作用,请使用MediaRecorder.AudioSource.MIC
MediaRecd = new MediaRecorder();
MediaRecd.setAudioSource(MediaRecorder.AudioSource.MIC
);