aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-11 19:48:57 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-11 19:48:57 -0700
commit2b11caece9c49406099fc192fda4215171ef0f58 (patch)
tree5c59e7ee320a3a3d55dd969ee5f1381b8ebfb274 /src
parent4a2cd22d126ac49783d96f84f4d9df2d855975ed (diff)
downloaddsub-2b11caece9c49406099fc192fda4215171ef0f58.tar.gz
dsub-2b11caece9c49406099fc192fda4215171ef0f58.tar.bz2
dsub-2b11caece9c49406099fc192fda4215171ef0f58.zip
Fix issue with going to repeat song mode not removing nextPlaying setup
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 901d0578..44c22009 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -700,6 +700,7 @@ public class DownloadService extends Service {
nextPlayingTask = new CheckCompletionTask(nextPlaying);
nextPlayingTask.execute();
} else {
+ resetNext();
nextPlaying = null;
}
}
@@ -996,6 +997,21 @@ public class DownloadService extends Service {
}
}
+ public synchronized void resetNext() {
+ if(nextMediaPlayer != null) {
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ mediaPlayer.setNextMediaPlayer(null);
+ nextSetup = false;
+ }
+
+ nextMediaPlayer.setOnCompletionListener(null);
+ nextMediaPlayer.setOnErrorListener(null);
+ nextMediaPlayer.reset();
+ nextMediaPlayer.release();
+ nextMediaPlayer = null;
+ }
+ }
+
public int getPlayerPosition() {
try {
if (playerState == IDLE || playerState == DOWNLOADING || playerState == PREPARING) {
@@ -1397,13 +1413,7 @@ public class DownloadService extends Service {
private synchronized void setupNext(final DownloadFile downloadFile) {
try {
final File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile();
- if(nextMediaPlayer != null) {
- nextMediaPlayer.setOnCompletionListener(null);
- nextMediaPlayer.setOnErrorListener(null);
- nextMediaPlayer.reset();
- nextMediaPlayer.release();
- nextMediaPlayer = null;
- }
+ resetNext();
// Exit when using remote controllers
if(remoteState != RemoteControlState.LOCAL) {