diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-12-27 12:08:59 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-12-27 12:08:59 -0800 |
commit | 2254ad9740d1b9b54144c74cc6265d5f66a180fa (patch) | |
tree | aa94e51df08cb522db4effb605407f8df15a59a3 | |
parent | 1b12fed0c03a957ce5ef98fd39a282b210f5100e (diff) | |
download | dsub-2254ad9740d1b9b54144c74cc6265d5f66a180fa.tar.gz dsub-2254ad9740d1b9b54144c74cc6265d5f66a180fa.tar.bz2 dsub-2254ad9740d1b9b54144c74cc6265d5f66a180fa.zip |
Fix an issue with resuming local casting skipping current song sometimes
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 3f643593..aa575145 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -1344,6 +1344,11 @@ public class DownloadService extends Service { setRemoteState(newState, ref, null); } private void setRemoteState(final RemoteControlState newState, final Object ref, final String routeId) { + // Don't try to do anything if already in the correct state + if(remoteState == newState) { + return; + } + boolean isPlaying = playerState == STARTED; int position = getPlayerPosition(); @@ -1358,6 +1363,7 @@ public class DownloadService extends Service { } } + Log.i(TAG, remoteState.name() + " => " + newState.name() + " (" + currentPlaying + ")"); remoteState = newState; switch(newState) { case JUKEBOX_SERVER: @@ -1484,6 +1490,7 @@ public class DownloadService extends Service { subtractPosition = 0; mediaPlayer.setOnCompletionListener(null); + mediaPlayer.setOnPreparedListener(null); mediaPlayer.reset(); setPlayerState(IDLE); try { |