MediaRecorder启动失败:-38 [英] MediaRecorder start failed: -38

查看:2886
本文介绍了MediaRecorder启动失败:-38的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索来检查,如果这个问题没有DUP,我看到一些没有答案,其他人并没有帮助。

i searched to check if this question is no dup , i see some has no answer and others did not help.

这是我的code:

private void startRecording()
{
            mRecorder = new MediaRecorder();
            mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
            mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

            mFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
              mFileName += "/recordedHeckPost_.3gp";

            mRecorder.setOutputFile(mFileName);                  

                try {
                    mRecorder.prepare();
                    //Thread.sleep(2000);
                    mRecorder.start();                  
        }
                catch (InterruptedException e) 
                {   // TODO Auto-generated catch block
            e.printStackTrace();
        }     
            catch(IllegalStateException e)
            {
                e.printStackTrace();
            } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
}

private void stopRecording()
{
        mRecorder.stop();
        mRecorder.release();
        mRecorder = null;
}

运行此code(在Nexus的5)我得到了下面开始后的失败-38例外

05-31 18:17:39.404: E/MediaRecorder(2464): start failed: -38
05-31 18:17:39.404: W/System.err(2464): java.lang.IllegalStateException
05-31 18:17:39.404: W/System.err(2464):     at android.media.MediaRecorder.start(Native Method)

感谢。

推荐答案

找到了解决办法,看来我在后台一些其他的服务,这是使用 AudioRecord并使用麦克风以及....因此多数民众赞成在-38 :)

Found the solution , it appears i had some other service in the background which is using AudioRecord and uses the mic as well.... so thats the -38 :)

这篇关于MediaRecorder启动失败:-38的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆