[Android] PlayerController: Prevent IllegalStateException
Geoffrey Métais
git at videolan.org
Fri Mar 1 18:21:42 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 1 15:54:40 2019 +0100| [71d43fe5e2934b18503720371ef681af9a148dc1] | committer: Geoffrey Métais
PlayerController: Prevent IllegalStateException
> https://code.videolan.org/videolan/vlc-android/commit/71d43fe5e2934b18503720371ef681af9a148dc1
---
vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index d1dd484dd..135863f09 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -115,9 +115,9 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
fun isPlaying() = playbackState == PlaybackStateCompat.STATE_PLAYING
- fun isVideoPlaying() = mediaplayer.vlcVout.areViewsAttached()
+ fun isVideoPlaying() = !mediaplayer.isReleased && mediaplayer.vlcVout.areViewsAttached()
- fun canSwitchToVideo() = mediaplayer.hasMedia() && mediaplayer.videoTracksCount > 0
+ fun canSwitchToVideo() = getVideoTracksCount() > 0
fun getVideoTracksCount() = if (!mediaplayer.isReleased && mediaplayer.hasMedia()) mediaplayer.videoTracksCount else 0
More information about the Android
mailing list