diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-29 07:38:45 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-29 07:38:45 -0700 |
commit | b5c7529ed34139e382376d090e9f933e2c3ede18 (patch) | |
tree | 114dd497e889c08f5aff1c05c3990aa03f744acc /subsonic-android | |
parent | a4208e2bbf70836bf2c233f86053347371af29b5 (diff) | |
download | dsub-b5c7529ed34139e382376d090e9f933e2c3ede18.tar.gz dsub-b5c7529ed34139e382376d090e9f933e2c3ede18.tar.bz2 dsub-b5c7529ed34139e382376d090e9f933e2c3ede18.zip |
Remove a bunch of changes that didn't help
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index ed869daf..f6d3f769 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -89,7 +89,6 @@ public class DownloadServiceImpl extends Service implements DownloadService { private final IBinder binder = new SimpleServiceBinder<DownloadService>(this); private Looper mediaPlayerLooper; - private MediaPlayer lpaPlayer; private MediaPlayer mediaPlayer; private MediaPlayer nextMediaPlayer; private boolean nextSetup = false; @@ -147,19 +146,6 @@ public class DownloadServiceImpl extends Service implements DownloadService { public void run() { Looper.prepare(); - // LPA Player on some devices causes weird issues, hold a default media player to mask them - try { - File randomSong = FileUtil.getAnySong(DownloadServiceImpl.this); - - lpaPlayer = new MediaPlayer(); - lpaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); - lpaPlayer.setDataSource(randomSong.getPath()); - lpaPlayer.prepareAsync(); - } catch(Exception e) { - // Failed to setup, ignore - Log.w(TAG, "Failed to setup redirect media player", e); - } - mediaPlayer = new MediaPlayer(); mediaPlayer.setWakeMode(DownloadServiceImpl.this, PowerManager.PARTIAL_WAKE_LOCK); @@ -235,7 +221,6 @@ public class DownloadServiceImpl extends Service implements DownloadService { i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName()); sendBroadcast(i); - lpaPlayer.release(); mediaPlayer.release(); if(nextMediaPlayer != null) { nextMediaPlayer.release(); @@ -885,34 +870,21 @@ public class DownloadServiceImpl extends Service implements DownloadService { private class PositionCache implements Runnable { boolean isRunning = true; - Thread thread; public void stop() { isRunning = false; - if(thread != null) { - // Make it stop right NOW - thread.interrupt(); - } } @Override public void run() { - thread = Thread.currentThread(); - 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)) { + while(isRunning) { try { if(mediaPlayer != null && playerState == STARTED) { cachedPosition = mediaPlayer.getCurrentPosition(); } Thread.sleep(200L); } - catch (InterruptedException e) { - // Purposely interrupted, don't log error - isRunning = false; - positionCache = null; - } catch(Exception e) { Log.w(TAG, "Crashed getting current position", e); isRunning = false; |