diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 0e64f484f..a0e74355f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -610,13 +610,26 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { executor.shutdown(); if (mediaPlayer != null) { try { - mediaPlayer.stop(); + removeMediaPlayerErrorListener(); + if (mediaPlayer.isPlaying()) { + mediaPlayer.stop(); + } } catch (Exception ignore) { } mediaPlayer.release(); } releaseWifiLockIfNecessary(); } + private void removeMediaPlayerErrorListener() { + if (mediaPlayer instanceof VideoPlayer) { + VideoPlayer vp = (VideoPlayer) mediaPlayer; + vp.setOnErrorListener((mp, what, extra) -> true); + } else if (mediaPlayer instanceof AudioPlayer) { + AudioPlayer ap = (AudioPlayer) mediaPlayer; + ap.setOnErrorListener((mediaPlayer, i, i1) -> true); + } + } + /** * Releases internally used resources. This method should only be called when the object is not used anymore. * This method is executed on an internal executor service. |