13

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

Bhanu Sharma
  • 5,135
  • 2
  • 24
  • 49

1 Answers1

-1

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
        );
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
vishal jangid
  • 2,967
  • 16
  • 22