aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-09-19 11:47:24 -0700
committerScott Jackson <daneren2005@gmail.com>2014-09-19 11:47:24 -0700
commit77c72cc77231723d7ba7ee51d74b9b47e5179464 (patch)
tree10a041edf3309310cd7631fc020c706567f28539
parentc040b8bdf7bb4df8bbaf5d41887e4f5a98dbbe1c (diff)
downloaddsub-77c72cc77231723d7ba7ee51d74b9b47e5179464.tar.gz
dsub-77c72cc77231723d7ba7ee51d74b9b47e5179464.tar.bz2
dsub-77c72cc77231723d7ba7ee51d74b9b47e5179464.zip
#404 Fix Tasker calling start() during PREPARE
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java13
1 files changed, 11 insertions, 2 deletions
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);
}