MediaRecorder IOException: prepare failed

后端 未结 6 426
北恋
北恋 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 09:00

    This Exception will be raised . if any of the following things failed:

    file not found: Ensure that output file location that yu have specified is existing, otherwise it will throw you filenotfoundexception

    Write Permission: You must specify Write permission in your manifest file.

    Record permission : specify Record permission in your manifest file.

    you can use this..

    
    

    Still you get error.. try display the error. Like this

    try{
            mRecorder.prepare();
    
        } catch (IOException e) {
            Log.e(LOG_TAG, "prepare() failed");
           System.out.println(""+e);    //to display the error
        }
    

    mRecorder.start();

提交回复
热议问题