From 1544e0747357325f5c970c1455b59895245e1ef2 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 21 Sep 2021 23:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/service/HttpReadAloudService.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index db614ca7f..07d25ab53 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -203,17 +203,21 @@ class HttpReadAloudService : BaseReadAloudService(), override fun pauseReadAloud(pause: Boolean) { super.pauseReadAloud(pause) - mediaPlayer.pause() - playIndexJob?.cancel() + kotlin.runCatching { + playIndexJob?.cancel() + mediaPlayer.pause() + } } override fun resumeReadAloud() { super.resumeReadAloud() - if (playingIndex == -1) { - play() - } else { - mediaPlayer.start() - upPlayPos() + kotlin.runCatching { + if (playingIndex == -1) { + play() + } else { + mediaPlayer.start() + upPlayPos() + } } }