Media Recorder To record calls is sometime unable to Record other side voice

走远了吗. 提交于 2019-12-18 03:21:05

问题


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


回答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
        );


来源:https://stackoverflow.com/questions/45880954/media-recorder-to-record-calls-is-sometime-unable-to-record-other-side-voice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!