[Android] Prevent illegalStateException on media stop

Geoffrey Métais git at videolan.org
Wed May 16 15:50:54 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 16 15:14:43 2018 +0200| [b3d0408714bd670412ebd43df085877357a7fff9] | committer: Geoffrey Métais

Prevent illegalStateException on media stop

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

 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 46b2fa944..1877029e3 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -133,7 +133,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
 
     fun getSpuDelay() = mediaplayer.spuDelay
 
-    fun getRate() = mediaplayer.rate
+    fun getRate() = if (mediaplayer.hasMedia()) mediaplayer.rate else 1.0f
 
     fun setSpuDelay(delay: Long) = mediaplayer.setSpuDelay(delay)
 



More information about the Android mailing list