aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-11-30 17:54:27 -0800
committerScott Jackson <daneren2005@gmail.com>2015-11-30 17:54:27 -0800
commitcef807002df9adaeabe8937510444f2372a6e784 (patch)
tree67e7898e6b492dad6c506bccaa44d326888ac890 /app
parent32fd7c300851ebd558cd17a7d5c90f8cf7f17530 (diff)
downloaddsub-cef807002df9adaeabe8937510444f2372a6e784.tar.gz
dsub-cef807002df9adaeabe8937510444f2372a6e784.tar.bz2
dsub-cef807002df9adaeabe8937510444f2372a6e784.zip
Fix gapless playback on DLNA not scrobbling completion
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/ChromeCastController.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DLNAController.java6
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java8
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);