aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-03-11 06:28:49 -0700
committerScott Jackson <daneren2005@gmail.com>2014-03-11 06:28:49 -0700
commit3463d106f1c92a4fdb4b1a1bb94d18e6cfd2f03b (patch)
tree468e63357f61ca9e35645a5a917fccff9d1843cf
parente3569694756abe5847e96ea8456cdf523a9a71d9 (diff)
downloaddsub-3463d106f1c92a4fdb4b1a1bb94d18e6cfd2f03b.tar.gz
dsub-3463d106f1c92a4fdb4b1a1bb94d18e6cfd2f03b.tar.bz2
dsub-3463d106f1c92a4fdb4b1a1bb94d18e6cfd2f03b.zip
Fix clearing playlist while casting
-rw-r--r--src/github/daneren2005/dsub/service/ChromeCastController.java13
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java
index 2a8a8e93..dfb74b33 100644
--- a/src/github/daneren2005/dsub/service/ChromeCastController.java
+++ b/src/github/daneren2005/dsub/service/ChromeCastController.java
@@ -178,7 +178,9 @@ public class ChromeCastController extends RemoteController {
@Override
public void updatePlaylist() {
-
+ if(downloadService.getCurrentPlaying() == null) {
+ startSong(null, false, 0);
+ }
}
@Override
@@ -221,7 +223,14 @@ public class ChromeCastController extends RemoteController {
void startSong(DownloadFile currentPlaying, boolean autoStart, int position) {
if(currentPlaying == null) {
- // Don't start anything
+ try {
+ if (mediaPlayer != null && !error) {
+ mediaPlayer.stop(apiClient);
+ }
+ } catch(IOException e) {
+ Log.e(TAG, "Failed to stop RemoteMediaPlayer", e);
+ }
+ downloadService.setPlayerState(PlayerState.IDLE);
return;
}
downloadService.setPlayerState(PlayerState.PREPARING);
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index eda0fc55..02a6ae84 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -1121,7 +1121,7 @@ public class DownloadService extends Service {
remoteController.shutdown();
remoteController = null;
- if(newState == RemoteCtronlState.LOCAL) {
+ if(newState == RemoteControlState.LOCAL) {
mediaRouter.setDefaultRoute();
}
}