Log As:
06-14 15:24:51.780: E/MidiFile(104): EAS_Prepare failed: [–31]
06-14 15:24:51.780: E/MediaPlayer(31976): error (1, –3)
06-14 15:24:51.780: E/Cocos2dxMusic(31976): playBackgroundMusic: error state
06-14 15:24:51.780: E/MediaPlayer(31976): Error (1,–3)
try to edit file Cocos2dxMusic.java, function playBackgroundMusic:
public void playBackgroundMusic(final String pPath, final boolean isLoop) {
if (this.mCurrentPath null) {
// it is the first time to play background music or end() was called
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
this.mCurrentPath = pPath;
} else {
if (!this.mCurrentPath.equals(pPath)) {
// play new background music
// release old resource and create a new one
if (this.mBackgroundMediaPlayer != null) {
this.mBackgroundMediaPlayer.release();
}
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
// record the path
this.mCurrentPath = pPath;
}
}
if (this.mBackgroundMediaPlayer null) {
Log.e(Cocos2dxMusic.TAG, “playBackgroundMusic: background media player is null”);
} else {
// if the music is playing or paused, stop it
boolean isStop = false;
if(mBackgroundMediaPlayer.isPlaying()){
isStop = true;
this.mBackgroundMediaPlayer.stop();
}
this.mBackgroundMediaPlayer.setLooping(isLoop);
try {
Log.e(Cocos2dxMusic.TAG, “playBackgroundMusic”);
if(isStop)
this.mBackgroundMediaPlayer.prepare();
this.mBackgroundMediaPlayer.seekTo(0);
this.mBackgroundMediaPlayer.start();
this.mPaused = false;
} catch (final Exception e) {
e.printStackTrace();
Log.e(Cocos2dxMusic.TAG, “playBackgroundMusic: error state”);
}
}
}