diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-11-30 17:19:15 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-11-30 17:19:15 -0800 |
commit | 32fd7c300851ebd558cd17a7d5c90f8cf7f17530 (patch) | |
tree | 0223674f133f098c58672c28520e9b840fdc120f | |
parent | 366c98a3abab425d562b4dba811d04093dfabdba (diff) | |
download | dsub-32fd7c300851ebd558cd17a7d5c90f8cf7f17530.tar.gz dsub-32fd7c300851ebd558cd17a7d5c90f8cf7f17530.tar.bz2 dsub-32fd7c300851ebd558cd17a7d5c90f8cf7f17530.zip |
#589 Fix case where we are trying to setup the next song before the current one is actually playing
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DLNAController.java | 2 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 11 |
2 files changed, 9 insertions, 4 deletions
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 a0dc16c1..94bf7231 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java @@ -633,7 +633,7 @@ public class DLNAController extends RemoteController { if(positionInfo.getTrackURI() != null && positionInfo.getTrackURI().equals(nextPlayingURI) && downloadService.getNextPlayerState() == PlayerState.PREPARED) { downloadService.setCurrentPlaying(nextPlaying, true); downloadService.setPlayerState(PlayerState.STARTED); - downloadService.setNextPlaying(); + downloadService.setNextPlayerState(PlayerState.IDLE); } 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 37070903..ae619802 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1416,9 +1416,7 @@ public class DownloadService extends Service { } if(remoteController != null && remoteController.isNextSupported()) { - if(playerState == STARTED && nextPlayerState == IDLE) { - setNextPlaying(); - } else if(playerState == PREPARING || playerState == IDLE) { + if(playerState == PREPARING || playerState == IDLE) { nextPlayerState = IDLE; } } @@ -2679,6 +2677,13 @@ public class DownloadService extends Service { } }); } + + // Setup next playing at least a couple of seconds into the song since both Chromecast and some DLNA clients report PLAYING when still PREPARING + if(position > 2000 && remoteController != null && remoteController.isNextSupported()) { + if(playerState == STARTED && nextPlayerState == IDLE) { + setNextPlaying(); + } + } } private void onStateUpdate() { final long atRevision = revision; |