[Android] PlayerController: Check player is not released

Geoffrey Métais git at videolan.org
Tue Feb 5 18:33:13 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb  5 18:32:37 2019 +0100| [0190610073d5ffb9be93292ccd52547b16883cff] | committer: Geoffrey Métais

PlayerController: Check player is not released

> https://code.videolan.org/videolan/vlc-android/commit/0190610073d5ffb9be93292ccd52547b16883cff
---

 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index d863ce50b..baa9fbce4 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -51,7 +51,7 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
     fun getMedia(): Media? = mediaplayer.media
 
     fun play() {
-        if (mediaplayer.hasMedia()) mediaplayer.play()
+        if (mediaplayer.hasMedia() && !mediaplayer.isReleased) mediaplayer.play()
     }
 
     fun pause(): Boolean {
@@ -63,7 +63,7 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
     }
 
     fun stop() {
-        if (mediaplayer.hasMedia()) mediaplayer.stop()
+        if (mediaplayer.hasMedia() && !mediaplayer.isReleased) mediaplayer.stop()
         setPlaybackStopped()
     }
 



More information about the Android mailing list