获取错误媒体播放器(-38,0)

时间:2014-03-05 10:13:15

标签: android media-player audio

我收到错误“MediaPlayer(12807):错误(-38,0)” 当我第一次播放声音时,播放效果很好。但是当我停止播放声音并再次播放时,它会出现上述错误。 我的代码是

MediaPlayer mSoundMENU;

CONSTRUCTOR(){

     mSoundMENU = MediaPlayer.create(GameManager.getInstance().getCurrentActivity(), R.raw.mainmenu);
}
    STARTSOUND(){

    try {
                    mSoundMENU.setOnErrorListener(new OnErrorListener() {

                        @Override
                        public boolean onError(MediaPlayer mp, int what, int extra) {
                            Log.e("SOUND_MENUBG", "error = "+ what+" extra = "+extra);
                            return false;
                        }
                    });
                    mSoundMENU.prepare();
                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                mSoundMENU.setLooping(true);
                mSoundMENU.setVolume(1.0f, 1.0f);
                mSoundMENU.start();
    }

    STOPSOUND(){
    if(mSoundMENU != null){
        mSoundMENU.setVolume(0.0f,0.0f);
        mSoundMENU.stop();
        }
    }

0 个答案:

没有答案