MediaRecorder crashes on start

后端 未结 8 1731
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 12:25

i\'ve searched many topics but no straight answer.

I have this code :

        recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecord         


        
8条回答
  •  有刺的猬
    2020-12-06 12:42

    I had the same problem. This is because I had missed a slash while setting the filename for the recorded audio.

    change

    this.fileName = Environment.getExternalStorageDirectory().getAbsolutePath();
    this.fileName += "yourfilename.3gp";
    

    to

    this.fileName = Environment.getExternalStorageDirectory().getAbsolutePath();
    this.fileName += "/yourfilename.3gp";
    

提交回复
热议问题