[Android] Fix IllegalStateException
Nicolas Pomepuy
git at videolan.org
Thu Aug 12 11:56:12 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Aug 12 09:56:36 2021 +0200| [c4e9dd7c59309cc92a195f44fc51eac83145fed4] | committer: Nicolas Pomepuy
Fix IllegalStateException
> https://code.videolan.org/videolan/vlc-android/commit/c4e9dd7c59309cc92a195f44fc51eac83145fed4
---
.../vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/application/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index 4127cd5d5..514da9c5e 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -99,10 +99,12 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
@MainThread
fun restart() {
val mp = mediaplayer
- val volume = mp.volume
+ val volume:Int? = if (!mp.isReleased) mp.volume else null
mediaplayer = newMediaPlayer()
- if (volume > 100) {
- mediaplayer.volume = volume
+ volume?.let {
+ if (it > 100) {
+ mediaplayer.volume = it
+ }
}
release(mp)
}
More information about the Android
mailing list