diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-04-19 15:21:04 -0700 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-04-19 15:21:04 -0700 |
commit | 03bdca37fbde570746ac03a633ea06c20c310ec7 (patch) | |
tree | 3a3079a3205ae8a8bde68eddeb5b421814ad418b /subsonic-android/src | |
parent | 243d9cc7d3a154e15f7c4ae17516c656d6e43d17 (diff) | |
download | dsub-03bdca37fbde570746ac03a633ea06c20c310ec7.tar.gz dsub-03bdca37fbde570746ac03a633ea06c20c310ec7.tar.bz2 dsub-03bdca37fbde570746ac03a633ea06c20c310ec7.zip |
Try to stop position caching well before end of the song is reached
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 5975b9fe..fce9ef5f 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -882,7 +882,10 @@ public class DownloadServiceImpl extends Service implements DownloadService { @Override public void run() { thread = Thread.currentThread(); - while(isRunning) { + int duration = currentPlaying.getSong().getDuration() == null ? mediaPlayer.getDuration() : currentPlaying.getSong().getDuration() * 1000; + cachedPosition = 0; + // Stop checking position before the song reaches completion + while(isRunning && (Math.abs(duration - cachedPosition) < 1000)) { try { if(mediaPlayer != null && playerState == STARTED) { cachedPosition = mediaPlayer.getCurrentPosition(); |