[Android] Prevent illegalStateException on media stop

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


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

Prevent illegalStateException on media stop

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

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