浏览代码

Player: don't try to pause a non-running media player

Fixes an issue triggered by pausing, and then minimizing and coming back to the app.

Right now state is still lost (file returns to the beginning) but as a stopgap it's OK.
In the future, the state machine and how it interacts with the fragment should be reworked.

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 年之前
父节点
当前提交
37dfb5eb2c
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/main/java/com/nextcloud/client/media/Player.kt

+ 4 - 2
src/main/java/com/nextcloud/client/media/Player.kt

@@ -152,8 +152,10 @@ internal class Player(
 
         override fun onPausePlayback() {
             trace("onPausePlayback()")
-            mediaPlayer?.pause()
-            listener?.onPause()
+            if (mediaPlayer?.isPlaying == true) {
+                mediaPlayer?.pause()
+                listener?.onPause()
+            }
         }
 
         override fun onRequestFocus() {