[Android] Fetch volume only if a media is loaded

Geoffrey Métais git at videolan.org
Tue May 15 15:53:32 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 14 15:52:05 2018 +0200| [cd2a60c7e321d721d4255359ad3d020f6a622b5b] | committer: Geoffrey Métais

Fetch volume only if a media is loaded

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

 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 655a3e6ed..97fcb4b73 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -257,7 +257,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
         mediaplayer.title = title
     }
 
-    fun getVolume() = mediaplayer.volume
+    fun getVolume() = if (mediaplayer.hasMedia()) mediaplayer.volume else 100
 
     fun setVolume(volume: Int) = mediaplayer.setVolume(volume)
 



More information about the Android mailing list