MediaRecorder IOException: prepare failed

后端 未结 6 418
北恋
北恋 2021-01-18 08:11

I want to use MediaRecorder to record voice, my code is:

 public void record(View v) {
       Log.d(TAG, \"record\");

    this.mediaRecorder.setAudioChannel         


        
6条回答
  •  醉话见心
    2021-01-18 08:44

    First at all you code looks fine. Have you added the required permissions to your manifest file?

    
    
    

    If yes, then try replacing:

    this.mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    

    by

    this.mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    

    Don't forget to check if the path of your video file is correct.

提交回复
热议问题