From 77c72cc77231723d7ba7ee51d74b9b47e5179464 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 19 Sep 2014 11:47:24 -0700 Subject: #404 Fix Tasker calling start() during PREPARE --- src/github/daneren2005/dsub/service/DownloadService.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 33ec85c6..9d454817 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -968,7 +968,13 @@ public class DownloadService extends Service { if (remoteState != RemoteControlState.LOCAL) { remoteController.start(); } else { - mediaPlayer.start(); + // Only start if done preparing + if(playerState != PREPARING) { + mediaPlayer.start(); + } else { + // Otherwise, we need to set it up to start when done preparing + autoPlayStart = true; + } } setPlayerState(STARTED); } catch (Exception x) { @@ -1396,9 +1402,12 @@ public class DownloadService extends Service { } cachedPosition = position; - if (start) { + if (start || autoPlayStart) { mediaPlayer.start(); setPlayerState(STARTED); + + // Disable autoPlayStart after done + autoPlayStart = false; } else { setPlayerState(PAUSED); } -- cgit v1.2.3