[Android] PlayerController: prevent IllegalStateException

Geoffrey Métais git at videolan.org
Wed Mar 6 15:43:09 CET 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  6 15:11:52 2019 +0100| [118124a77b8ac4a92374498e5ae83cd282ea6c8b] | committer: Geoffrey Métais

PlayerController: prevent IllegalStateException

(cherry picked from commit 5245d311aca8d2ef485dfc7d78a0f6c670930e29)

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

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index 135863f09..818732987 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -226,6 +226,7 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
     fun getLength() = progress.value?.length ?: 0L
 
     fun setRate(rate: Float, save: Boolean) {
+        if (mediaplayer.isReleased) return
         mediaplayer.rate = rate
         if (save && settings.getBoolean(PreferencesActivity.KEY_PLAYBACK_SPEED_PERSIST, false))
             settings.edit().putFloat(PreferencesActivity.KEY_PLAYBACK_RATE, rate).apply()



More information about the Android mailing list