diff options
author | orionlee <orionlee@yahoo.com> | 2019-02-27 14:59:31 -0800 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2019-02-27 14:59:31 -0800 |
commit | a3389490bbc17fdf7001b0f6625621448e13c47c (patch) | |
tree | d5f62808012d987d09e1632b71219911e4ec661c /core/src/main/java | |
parent | ab78c1d4108551bb5691683bde81396612446c6e (diff) | |
download | AntennaPod-a3389490bbc17fdf7001b0f6625621448e13c47c.zip |
ensure the service continues to run in the event it takes a long time for the service to load the media to play, e.g.,
streaming over a slow network.
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 8 |
1 files changed, 8 insertions, 0 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 a0b368f86..baa7a032f 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 @@ -1932,6 +1932,14 @@ public class PlaybackService extends MediaBrowserServiceCompat { try { // Manage the started state of this service. switch (state.getState()) { + case PlaybackStateCompat.STATE_CONNECTING: + // move the service to started, aka, making it foreground + // upon STATE_CONNECTING, i.e., in preparing to play a media. + // This is done so that in case the preparation takes a long time, e.g., + // streaming over a slow network, + // the service won't be killed by the system prematurely. + moveServiceToStartedState(state); + break; case PlaybackStateCompat.STATE_PLAYING: moveServiceToStartedState(state); break; |