After digging in I figure out the easy way to diagnose issues related to this.
First thing you should do is hook up setOnErrorListener
because it gives you a correct error codes related to the error.
mediaPlayer.setOnErrorListener(new OnErrorListener() {
public boolean onError(MediaPlayer mp, int what, int extra) {
onPlaybackError();
return true;
}
});
Eg,
E/MediaPlayer(): error (1, -17)
When it comes to error codes, Android documentation sucks. You have to go to the source code to look after the error codes to find out whats wrong
Error codes are located here
In this case it was
const PVMFStatus PVMFErrResource = (-17);
Error due to general error in underlying resource
After some more digging i found out the reason for this error.
Android has a total of 8 instances of the player to share among all apps.
You are likely to get this error if you have ran out. so watch out!!
Great job. I have the same issue and nobody couldn't say me why. Thank you.
ReplyDelete