[Android] Player controller: check player is not released

Geoffrey Métais git at videolan.org
Tue Feb 5 16:34:31 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb  5 16:28:36 2019 +0100| [6d16423c12eef1062e3d63285cb07851bef14d8d] | committer: Geoffrey Métais

Player controller: check player is not released

> https://code.videolan.org/videolan/vlc-android/commit/6d16423c12eef1062e3d63285cb07851bef14d8d
---

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index 857669cc5..d863ce50b 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -272,7 +272,7 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
 
     fun getVolume() = if (mediaplayer.hasMedia()) mediaplayer.volume else 100
 
-    fun setVolume(volume: Int) = mediaplayer.setVolume(volume)
+    fun setVolume(volume: Int) = if (!mediaplayer.isReleased) mediaplayer.setVolume(volume) else -1
 
     suspend fun expand(): MediaList? {
         return mediaplayer.media?.let {



More information about the Android mailing list