In my application there is a feature to record voice calls and it works perfectly well. But when tested on (Samsung s7, s8 ) it doesn’t work well. The application is able to record only callers voice not the voice from the other end. Below is my code to check please suggest a solution
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;
}
Please help
vishal jangid
AudioSource.VOICE_CALL
is not working in some android devices so
instead of VOICE_CALL
use below
First try MediaRecorder.AudioSource.CAMCORDER
MediaRecd = new MediaRecorder();
MediaRecd.setAudioSource(MediaRecorder.AudioSource.CAMCORDER
);
If above is not working than use MediaRecorder.AudioSource.MIC
MediaRecd = new MediaRecorder();
MediaRecd.setAudioSource(MediaRecorder.AudioSource.MIC
);
来源:https://stackoverflow.com/questions/45880954/media-recorder-to-record-calls-is-sometime-unable-to-record-other-side-voice