m_MediaPlayer = MediaPlayer.create(context, soundFromResource);
m_MediaPlayer.setVolume(0.99f, 0.99f);
m_MediaPlayer.setLooping(true);
m_MediaPlayer.setOnCompletionL
I solve this using this workaround:
public static void setMpLooping(final MediaPlayer mp, final boolean isLooping) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP
|| Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) {
if (isLooping) {
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.start();
}
});
} else {
mp.setOnCompletionListener(null);
}
} else {
mp.setLooping(isLooping);
}
}
But remember, sometimes there is a delay during the transition from end to start of the track on Lollipop