I've figured out that it's a better way to hide the MediaController in the onPause event.
@Override
protected void onPause() {
// Hide the MediaController and release the MediaPlayer
mMediaController.hide();
mPlayer.stop();
mPlayer.release();
super.onPause();
}
The error still appears on configuration changes (i.e. rotating the screen) but in my case it's good enough to prevent the Activity from recreating on configuration changes:
<activity
android:name=".MediaPlayerTest"
android:configChanges="orientation|screenSize">
</activity>
I'm still thinking that there's a strange behaviour (I won't call it a bug since it might be my bad) with the MediaController. But I won't put more of my time into this since it's kinda working.