play the previous song if we are less than 5 secs into the song, else restart

This commit is contained in:
tibbi 2016-01-19 22:22:30 +01:00
parent a1a76e58c0
commit ac0ccad4f8

View file

@ -88,8 +88,9 @@ public class MusicService extends Service
if (player == null)
initMediaPlayer();
// play the previous song if we are less than 5 secs into the song, else restart
// remove the latest song from the list
if (playedSongIDs.size() > 1) {
if (playedSongIDs.size() > 1 && player.getCurrentPosition() < 5000) {
playedSongIDs.remove(playedSongIDs.size() - 1);
setSong(playedSongIDs.get(playedSongIDs.size() - 1), false);
} else {