diff options
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 15 |
1 files changed, 4 insertions, 11 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 ec03f8db..cec98865 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1091,6 +1091,7 @@ public class DownloadService extends Service { setCurrentPlaying(nextPlaying, true); setPlayerState(PlayerState.STARTED); setupHandlers(currentPlaying, false, start); + applyPlaybackParamsMain(); setNextPlaying(); // Proxy should not be being used here since the next player was already setup to play @@ -1300,6 +1301,7 @@ public class DownloadService extends Service { // Only start if done preparing if(playerState != PREPARING) { mediaPlayer.start(); + applyPlaybackParamsMain(); } else { // Otherwise, we need to set it up to start when done preparing autoPlayStart = true; @@ -1887,10 +1889,10 @@ public class DownloadService extends Service { cachedPosition = position; applyReplayGain(mediaPlayer, downloadFile); - applyPlaybackParams(mediaPlayer); if (start || autoPlayStart) { mediaPlayer.start(); + applyPlaybackParamsMain(); setPlayerState(STARTED); // Disable autoPlayStart after done @@ -1958,7 +1960,6 @@ public class DownloadService extends Service { } applyReplayGain(nextMediaPlayer, downloadFile); - applyPlaybackParamsNext(); } catch (Exception x) { handleErrorNext(x); } @@ -2617,9 +2618,6 @@ public class DownloadService extends Service { if(mediaPlayer != null && (playerState == PREPARED || playerState == STARTED || playerState == PAUSED || playerState == PAUSED_TEMP)) { applyPlaybackParamsMain(); } - if(nextMediaPlayer != null && nextPlayerState == PREPARED) { - applyPlaybackParamsNext(); - } delayUpdateProgress = Math.round(DEFAULT_DELAY_UPDATE_PROGRESS / playbackSpeed); } @@ -2634,11 +2632,6 @@ public class DownloadService extends Service { private synchronized void applyPlaybackParamsMain() { applyPlaybackParams(mediaPlayer); } - private synchronized void applyPlaybackParamsNext() { - if(isNextPlayingSameAlbum()) { - applyPlaybackParams(nextMediaPlayer); - } - } private synchronized boolean isNextPlayingSameAlbum() { return isNextPlayingSameAlbum(currentPlaying, nextPlaying); } @@ -2654,7 +2647,7 @@ public class DownloadService extends Service { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { float playbackSpeed = getPlaybackSpeed(); - if(playbackSpeed != 1.0f || mediaPlayer.getPlaybackParams() != null) { + if(Math.abs(playbackSpeed - 1.0) > 0.01 || mediaPlayer.getPlaybackParams() != null) { PlaybackParams playbackParams = new PlaybackParams(); playbackParams.setSpeed(playbackSpeed); mediaPlayer.setPlaybackParams(playbackParams); |