aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-01 17:13:14 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-01 17:13:14 -0700
commitf106f414f8c525bf31914b32d03f9a9f2ec4f5af (patch)
tree106278d1432e24d0c2bd4e7ebabb61870241c6a0 /app/src/main/java/github
parent6b08efedf0f212e99b627ebf590fa014b955351a (diff)
downloaddsub-f106f414f8c525bf31914b32d03f9a9f2ec4f5af.tar.gz
dsub-f106f414f8c525bf31914b32d03f9a9f2ec4f5af.tar.bz2
dsub-f106f414f8c525bf31914b32d03f9a9f2ec4f5af.zip
#532 Fix issues with play next with next loading
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java18
1 files changed, 14 insertions, 4 deletions
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 7c0c9ba1..bc465e74 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -819,11 +819,12 @@ public class DownloadService extends Service {
int index = getNextPlayingIndex();
- nextSetup = false;
if(nextPlayingTask != null) {
nextPlayingTask.cancel();
nextPlayingTask = null;
}
+ resetNext();
+
if(index < size() && index != -1 && index != currentPlayingIndex) {
nextPlaying = downloadList.get(index);
@@ -835,7 +836,7 @@ public class DownloadService extends Service {
}
} else {
if(remoteState == LOCAL) {
- resetNext();
+ // resetNext();
} else if(remoteController != null) {
remoteController.changeNextTrack(nextPlaying);
}
@@ -1227,14 +1228,16 @@ public class DownloadService extends Service {
if (nextMediaPlayer != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && nextSetup) {
mediaPlayer.setNextMediaPlayer(null);
- nextSetup = false;
}
+ nextSetup = false;
nextMediaPlayer.setOnCompletionListener(null);
nextMediaPlayer.setOnErrorListener(null);
nextMediaPlayer.reset();
nextMediaPlayer.release();
nextMediaPlayer = null;
+ } else if(nextSetup) {
+ nextSetup = false;
}
} catch (Exception e) {
Log.w(TAG, "Failed to reset next media player");
@@ -1795,6 +1798,11 @@ public class DownloadService extends Service {
nextMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
+ // Changed to different while preparing so ignore
+ if(nextMediaPlayer != mp) {
+ return;
+ }
+
try {
setNextPlayerState(PREPARED);
@@ -2634,7 +2642,9 @@ public class DownloadService extends Service {
// Start the setup of the next media player
mediaPlayerHandler.post(new Runnable() {
public void run() {
- setupNext(downloadFile);
+ if(!CheckCompletionTask.this.isCancelled()) {
+ setupNext(downloadFile);
+ }
}
});
return null;