I have a fairly standard mediaplayer object that starts up in onCreate and loops for background music in my app. The file isn't unusually large, it's a 6MB MP3. From the onCreate:
MediaPlayer mp;
mp = MediaPlayer.create(MainActivity.this, R.raw.lostmexicancity);
mp.setLooping(true);
mp.setVolume(0.4f, 0.4f);
mp.start();
This works just fine on most of my test devices including older phones, a Samsung Galaxy Tab 2 10" tablet, and even a Nexus 4.
Unfortunately, I am experiencing problems exclusively with newer devices where I encounter audio glitching/stuttering on the Nexus 5 and the newer Nexus 10. These issues ONLY happen on newer devices, usually after a few seconds of proper playback, not immediately. Both my Nexus 4 and 5 are running Android 4.4.4 and yet the issue only happens on the Nexus 5.
This issues seems to be exacerbated when I pause that mediaplayer object and play a different one for a short period of time (battle music for short fights in the game) but the glitching happens even without this additional complication.
I have read that newer versions of Android have caused issues with Mediaplayer, but I haven't come upon a fix or suggestion.
Has anyone else experienced this issue who can suggest a fix or work-around? Thank you for your time!