summaryrefslogtreecommitdiff
path: root/core/src/play/java/de
diff options
context:
space:
mode:
authorDomingos Lopes <domingos86lopes+github@gmail.com>2016-06-07 22:54:46 -0400
committerDomingos Lopes <domingos86lopes+github@gmail.com>2016-07-25 23:16:28 -0400
commitc9382e27c4a8840040367eec7e715a8591c19db8 (patch)
treeb0b57941e652b9ed21d617fea6f3957930eb0b55 /core/src/play/java/de
parentc17723816b9fd69bf3c541b177e48d195a69b28f (diff)
downloadAntennaPod-c9382e27c4a8840040367eec7e715a8591c19db8.zip
fix issue with playback ended on skipping (for remote playback)
Diffstat (limited to 'core/src/play/java/de')
-rw-r--r--core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java b/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
index e594f14ec..ea95ea894 100644
--- a/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
+++ b/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
@@ -634,11 +634,21 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer {
}
}
if (shouldContinue || toStoppedState) {
- if (nextMedia != null) {
- callback.onPlaybackEnded(null, true);
- stop();
+ boolean shouldPostProcess = true;
+ if (nextMedia == null) {
+ try {
+ castMgr.stop();
+ shouldPostProcess = false;
+ } catch (CastException | TransientNetworkDisconnectionException | NoConnectionException e) {
+ Log.e(TAG, "Unable to stop playback", e);
+ callback.onPlaybackEnded(null, true);
+ stop();
+ }
+ }
+ if (shouldPostProcess) {
+ // Otherwise we rely on the chromecast callback to tell us the playback has stopped.
+ callback.onPostPlayback(currentMedia, !wasSkipped, nextMedia != null);
}
- callback.onPostPlayback(currentMedia, !wasSkipped, nextMedia != null);
} else if (isPlaying) {
callback.onPlaybackPause(currentMedia,
currentMedia != null ? currentMedia.getPosition() : INVALID_TIME);