Do not restart sleep timer when automatically playing next episode

This commit is contained in:
ByteHamster 2020-01-31 16:37:42 +01:00
parent a0e3a04f67
commit 29bc5109a6

View File

@ -570,6 +570,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} else if (mediaPlayer.getPlayable() == null) { } else if (mediaPlayer.getPlayable() == null) {
startPlayingFromPreferences(); startPlayingFromPreferences();
} }
taskManager.restartSleepTimer();
return true; return true;
case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PLAY:
if (status == PlayerStatus.PAUSED || status == PlayerStatus.PREPARED) { if (status == PlayerStatus.PAUSED || status == PlayerStatus.PREPARED) {
@ -580,6 +581,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} else if (mediaPlayer.getPlayable() == null) { } else if (mediaPlayer.getPlayable() == null) {
startPlayingFromPreferences(); startPlayingFromPreferences();
} }
taskManager.restartSleepTimer();
return true; return true;
case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PAUSE:
if (status == PlayerStatus.PLAYING) { if (status == PlayerStatus.PLAYING) {
@ -827,9 +829,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
@Override @Override
public void onPlaybackStart(@NonNull Playable playable, int position) { public void onPlaybackStart(@NonNull Playable playable, int position) {
if (taskManager.isSleepTimerActive()) {
taskManager.restartSleepTimer();
}
taskManager.startWidgetUpdater(); taskManager.startWidgetUpdater();
if (position != PlaybackServiceMediaPlayer.INVALID_TIME) { if (position != PlaybackServiceMediaPlayer.INVALID_TIME) {
playable.setPosition(position); playable.setPosition(position);
@ -1446,10 +1445,12 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void resume() { public void resume() {
mediaPlayer.resume(); mediaPlayer.resume();
taskManager.restartSleepTimer();
} }
public void prepare() { public void prepare() {
mediaPlayer.prepare(); mediaPlayer.prepare();
taskManager.restartSleepTimer();
} }
public void pause(boolean abandonAudioFocus, boolean reinit) { public void pause(boolean abandonAudioFocus, boolean reinit) {