diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2017-05-07 11:41:09 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2017-05-07 11:41:09 +0200 |
commit | b1bb29ddc242878ab2611cad35ec96a6aace1d63 (patch) | |
tree | 372f8db6afb2fd359c64afa9abe1d835bf182825 /core | |
parent | 776f2234bef4046f61a2cc817ef0d53a229400de (diff) | |
download | AntennaPod-b1bb29ddc242878ab2611cad35ec96a6aace1d63.zip |
Keep playing episode when switching between day and night modes
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index b3200923b..c3e6b55ba 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -1407,8 +1407,15 @@ public class PlaybackService extends MediaBrowserServiceCompat { Log.d(TAG, "Car was unplugged during playback."); pauseIfPauseOnDisconnect(); } else { - mediaPlayer.setStartWhenPrepared(true); - mediaPlayer.prepare(); + PlayerStatus playerStatus = mediaPlayer.getPlayerStatus(); + if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PREPARED) { + mediaPlayer.resume(); + } else if (playerStatus == PlayerStatus.PREPARING) { + mediaPlayer.setStartWhenPrepared(!mediaPlayer.isStartWhenPrepared()); + } else if (playerStatus == PlayerStatus.INITIALIZED) { + mediaPlayer.setStartWhenPrepared(true); + mediaPlayer.prepare(); + } } } }; |