[Android] Fetch volume only if a media is loaded

Geoffrey Métais git at videolan.org
Mon May 14 15:53:17 CEST 2018


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

Fetch volume only if a media is loaded

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

 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 123c50c9c..a276b1868 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -252,7 +252,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