aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-08-24 17:13:02 -0700
committerScott Jackson <daneren2005@gmail.com>2016-08-24 17:13:02 -0700
commita05ecac6a649b11c8d6f277514dbc72d9bea674b (patch)
tree69eecfe79f231c58158e00d7868fea1079a6384a /app/src/main/java/github
parent1c72aa2607fa23f4a2b7253825ec88468afe1141 (diff)
downloaddsub-a05ecac6a649b11c8d6f277514dbc72d9bea674b.tar.gz
dsub-a05ecac6a649b11c8d6f277514dbc72d9bea674b.tar.bz2
dsub-a05ecac6a649b11c8d6f277514dbc72d9bea674b.zip
#730: Don't ever call MediaPlayer.setPlaybackParams before playback starts
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java15
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);