[Android] Pause only if playing

Geoffrey Métais git at videolan.org
Fri Jan 26 18:52:15 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 26 18:51:15 2018 +0100| [9cf743cc1878ade85220c830397c4feb1103d99e] | committer: Geoffrey Métais

Pause only if playing

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

 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index 809dffa28..8afaf7b57 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -43,9 +43,11 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
     }
 
     fun pause(): Boolean {
-        if (!mediaplayer.hasMedia() || !pausable) return false
-        mediaplayer.pause()
-        return true
+        if (isPlaying() && mediaplayer.hasMedia() && pausable) {
+            mediaplayer.pause()
+            return true
+        }
+        return false
     }
 
     fun stop() {



More information about the Android mailing list