recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioSamplingRate(8000);
recorder.setAudioEncodingBitRate(12200);
recorder.setOutputFile(audiofile.getAbsolutePath());
try {
recorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
recorder.start();
Source: https://issuetracker.google.com/issues/36907207?pli=1 msg# 504
Update: according to https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html it should use VOICE_CALL instead of MIC.
文章来源: https://acassis.wordpress.com/2022/05/13/recording-audio-call-on-android/
如有侵权请联系:admin#unsafe.sh