diff options
Diffstat (limited to 'app/src/main')
3 files changed, 9 insertions, 7 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/ChromeCastController.java b/app/src/main/java/github/daneren2005/dsub/service/ChromeCastController.java index 7d2b0a07..79312f44 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/ChromeCastController.java +++ b/app/src/main/java/github/daneren2005/dsub/service/ChromeCastController.java @@ -483,8 +483,6 @@ public class ChromeCastController extends RemoteController { break; case MediaStatus.PLAYER_STATE_IDLE: if (mediaStatus.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) { - downloadService.setPlayerState(PlayerState.COMPLETED); - downloadService.postPlayCleanup(); downloadService.onSongCompleted(); } else if (mediaStatus.getIdleReason() == MediaStatus.IDLE_REASON_INTERRUPTED) { if (downloadService.getPlayerState() != PlayerState.PREPARING) { diff --git a/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java b/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java index 94bf7231..f978c614 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java @@ -188,8 +188,6 @@ public class DLNAController extends RemoteController { failedLoad(); } else if(downloadService.getPlayerState() == PlayerState.STARTED) { // Played until the end - downloadService.setPlayerState(PlayerState.COMPLETED); - downloadService.postPlayCleanup(); downloadService.onSongCompleted(); } else { downloadService.setPlayerState(PlayerState.STOPPED); @@ -631,9 +629,7 @@ public class DLNAController extends RemoteController { currentPosition = (int) positionInfo.getTrackElapsedSeconds(); if(positionInfo.getTrackURI() != null && positionInfo.getTrackURI().equals(nextPlayingURI) && downloadService.getNextPlayerState() == PlayerState.PREPARED) { - downloadService.setCurrentPlaying(nextPlaying, true); - downloadService.setPlayerState(PlayerState.STARTED); - downloadService.setNextPlayerState(PlayerState.IDLE); + downloadService.onNextStarted(nextPlaying); } downloadService.postDelayed(new Runnable() { diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index ae619802..788f929e 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1189,8 +1189,16 @@ public class DownloadService extends Service { } public void onSongCompleted() { + setPlayerState(PlayerState.COMPLETED); + postPlayCleanup(); play(getNextPlayingIndex()); } + public void onNextStarted(DownloadFile nextPlaying) { + setPlayerState(COMPLETED); + postPlayCleanup(); + setCurrentPlaying(nextPlaying, true); + setPlayerState(STARTED); + } public synchronized void pause() { pause(false); |