android:media recorder:启动失败:-38

时间:2012-10-01 14:21:07

标签: android state voice recorder

简介:如何检查某些其他应用中的录音是否已在后台运行。

详细信息:如果录音已在本机应用程序的后台运行:录音机。 现在我已将录音作为我应用程序中的一项功能实现。

问题:当我在我的应用中同时尝试录制时,它会出错:

  : E/MediaRecorder: start failed: -38
  : E/MyApp: [1162][com.sec.MyApp.multimedia.RecordMyVoice]java.lang.IllegalStateException
  : E/MyApp:    at android.media.MediaRecorder.start(Native Method)
  : E/MyApp:    at com.sec.MyApp.multimedia.RecordMyVoice.doInBackground(RecordMyVoice.java:100)

RecordMyVoice.java中第100行的代码:

    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mRecorder.setOutputFile(mFileName);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    mRecorder.prepare();
    mRecorder.start(); //code at 100th line

但问题是因为录音已在后台运行。 因此,如果它在其他应用程序中运行,有没有办法停止录音。

任何输入都会有很大的帮助。

2 个答案:

答案 0 :(得分:1)

我有同样的错误-38,我发现有另一个后台服务使用麦克风通过(AudioRecord),当禁用后台服务时,它有效。

答案 1 :(得分:0)

检查文件路径,该目录必须存在。

相关问题