无法通过MediaRecorder.AudioSource.MIC录制呼叫。它在Recorder.start上停止

时间:2018-05-03 05:11:51

标签: mediarecorder

此方法位于服务类中,并且在选择呼叫时从广播接收器调用服务类(TelephonyManager.EXTRA_STATE_OFFHOOK)

  private void startRecording() throws IOException {
            if (!isRecording) {

            this.isRecording = true;

            recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            recorder.setAudioSamplingRate(8000);
            recorder.setAudioEncodingBitRate(12200);
            recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
            recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
            recorder.setOutputFile(getFilename());
            try {
                recorder.prepare();
             } catch (Exception e) {
                e.printStackTrace();
            }
            recorder.start();


        }
    }

0 个答案:

没有答案