Recently, I came across this, and, like some other questions, this error (marked by an outdated trick) https://code.google.com/p/android/issues/detail?id=9732
I found that this error occurs when playing a MIDI file, but only occasionally. This happens when mp.isPlaying () is called quickly after mp.start ()
If you fail to call mp.isPlaying () for a short time, an error does not occur. In my case, a tenth of a second or so made the difference between getting the error or not. This is inconvenient, but it works.
eg.
//setting a new track mp.setDataSource(path); mp.prepare(); mp.start(); //calling mp.isPlaying() here or shortly after starts the problem //since we know it playing, we can store that state, or call updateUiPlaying(); //eg instead of updateUi(); //or just call some code here that takes more time first updateScaledImages(); //something that might take time Log.v(TAG, "mp.isPlaying = " + mp.isPlaying()); //now isPlaying() shouldn't cause that error
In addition, I put a check when I stop later.
mp.pause() if(mp.isPlaying()){
Although the problem does not occur if there is a wait before calling isPlaying ()
jtav
source share