aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-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.java23
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RemoteController.java11
3 files changed, 20 insertions, 20 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 64abce8a..a0dc16c1 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DLNAController.java
@@ -171,11 +171,6 @@ public class DLNAController extends RemoteController {
switch (lastChange.getEventedValue(0, AVTransportVariable.TransportState.class).getValue()) {
case PLAYING:
downloadService.setPlayerState(PlayerState.STARTED);
-
- // Try to setup next playing after playback start has been registered
- if(supportsSetupNext && downloadService.getNextPlayerState() == PlayerState.IDLE) {
- downloadService.setNextPlaying();
- }
break;
case PAUSED_PLAYBACK:
downloadService.setPlayerState(PlayerState.PAUSED);
@@ -408,7 +403,6 @@ public class DLNAController extends RemoteController {
Pair<String, String> songInfo = getSongInfo(currentPlaying);
currentPlayingURI = songInfo.getFirst();
- downloadService.setNextPlayerState(PlayerState.IDLE);
controlPoint.execute(new SetAVTransportURI(getTransportService(), songInfo.getFirst(), songInfo.getSecond()) {
@Override
public void success(ActionInvocation invocation) {
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 baff1a72..37070903 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -401,7 +401,10 @@ public class DownloadService extends Service {
offset++;
}
}
- setNextPlaying();
+
+ if(remoteState == LOCAL || (remoteController != null && remoteController.isNextSupported())) {
+ setNextPlaying();
+ }
} else {
int size = size();
int index = getCurrentPlayingIndex();
@@ -881,13 +884,13 @@ public class DownloadService extends Service {
if(remoteState == LOCAL) {
nextPlayingTask = new CheckCompletionTask(nextPlaying);
nextPlayingTask.execute();
- } else if(remoteController != null) {
+ } else if(remoteController != null && remoteController.isNextSupported()) {
remoteController.changeNextTrack(nextPlaying);
}
} else {
if(remoteState == LOCAL) {
// resetNext();
- } else if(remoteController != null) {
+ } else if(remoteController != null && remoteController.isNextSupported()) {
remoteController.changeNextTrack(nextPlaying);
}
nextPlaying = null;
@@ -1100,11 +1103,14 @@ public class DownloadService extends Service {
}
mediaPlayer.seekTo(position);
- cachedPosition = position;
subtractPosition = 0;
}
+ cachedPosition = position;
onSongProgress();
+ if(playerState == PAUSED) {
+ lifecycleSupport.serializeDownloadQueue();
+ }
} catch (Exception x) {
handleError(x);
}
@@ -1408,6 +1414,15 @@ public class DownloadService extends Service {
positionCache.stop();
positionCache = null;
}
+
+ if(remoteController != null && remoteController.isNextSupported()) {
+ if(playerState == STARTED && nextPlayerState == IDLE) {
+ setNextPlaying();
+ } else if(playerState == PREPARING || playerState == IDLE) {
+ nextPlayerState = IDLE;
+ }
+ }
+
onStateUpdate();
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RemoteController.java b/app/src/main/java/github/daneren2005/dsub/service/RemoteController.java
index cac28c09..99502f5e 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RemoteController.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RemoteController.java
@@ -19,18 +19,11 @@
package github.daneren2005.dsub.service;
-import android.content.Context;
import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ProgressBar;
-import android.widget.Toast;
import java.util.Iterator;
import java.util.concurrent.LinkedBlockingQueue;
-import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.RemoteStatus;
import github.daneren2005.serverproxy.WebProxy;
@@ -48,9 +41,7 @@ public abstract class RemoteController {
public abstract void changePosition(int seconds);
public abstract void changeTrack(int index, DownloadFile song);
// Really is abstract, just don't want to require RemoteController's support it
- public void changeNextTrack(DownloadFile song) {
-
- };
+ public void changeNextTrack(DownloadFile song) {}
public boolean isNextSupported() {
return this.nextSupported;
}