Add a delay after starting a new track when we won't move onto the next track. Fixes #1

This commit is contained in:
Adam Baker 2018-06-20 18:09:30 +01:00
parent b27be9ee66
commit 4501cdd14a

View file

@ -105,6 +105,8 @@ public class MediaRouterPlayService extends Service {
private boolean mPollingStatus = false; private boolean mPollingStatus = false;
private int mStartingTrack = 0;
private boolean mBound; private boolean mBound;
/** /**
@ -270,6 +272,7 @@ public class MediaRouterPlayService extends Service {
return; return;
mCurrentTrack = trackNumber; mCurrentTrack = trackNumber;
mStartingTrack = 3;
Item track = mPlaylist.get(trackNumber); Item track = mPlaylist.get(trackNumber);
DIDLParser parser = new DIDLParser(); DIDLParser parser = new DIDLParser();
DIDLContent didl = new DIDLContent(); DIDLContent didl = new DIDLContent();
@ -483,10 +486,13 @@ public class MediaRouterPlayService extends Service {
stopForeground(true); stopForeground(true);
} }
if (status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_FINISHED || if ((status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_FINISHED ||
status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_CANCELED) { status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_CANCELED) &&
(mStartingTrack == 0)) {
playNext(); playNext();
} }
if (mStartingTrack > 0)
mStartingTrack--;
} }
}); });
} }