From 2ad41824e560c596aa7dcf6df556230ed0d12e0d Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 28 Dec 2012 20:18:15 -0800 Subject: Fixed playing currently streaming files --- .../src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 66f8a79f..0fd2f9ac 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -672,6 +672,8 @@ public class DownloadServiceImpl extends Service implements DownloadService { bufferTask.cancel(); } try { + mediaPlayer.setOnErrorListener(null); + mediaPlayer.setOnCompletionListener(null); mediaPlayer.reset(); setPlayerState(IDLE); } catch (Exception x) { @@ -824,7 +826,6 @@ public class DownloadServiceImpl extends Service implements DownloadService { } private synchronized void doPlay(final DownloadFile downloadFile, final int position, final boolean start) { - // TODO: Start play at curr pos on rebuffer instead of restart try { final File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile(); downloadFile.updateModificationDate(); @@ -906,7 +907,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { public boolean onError(MediaPlayer mediaPlayer, int what, int extra) { - Log.w(TAG, "Error on playing file " + "(" + what + ", " + extra + "): " + file.getPath()); + Log.w(TAG, "Error on playing file " + "(" + what + ", " + extra + "): " + downloadFile); reset(); downloadFile.setPlaying(false); doPlay(downloadFile, 0, true); -- cgit v1.2.3