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 744ed37ae..b49c2ee82 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -64,14 +64,14 @@ class HttpReadAloudService : BaseReadAloudService(), } else { super.play() kotlin.runCatching { - if (nowSpeak == 0 && downloadTask?.isActive != true) { + if (nowSpeak == 0) { downloadAudio() } else { val fileName = md5SpeakFileName(contentList[nowSpeak]) val file = getSpeakFileAsMd5(fileName) if (file.exists()) { playAudio(file) - } else if (downloadTask?.isActive != true) { + } else if (!downloadTaskIsActive) { downloadAudio() } } @@ -193,6 +193,8 @@ class HttpReadAloudService : BaseReadAloudService(), } }.onStart { downloadTaskIsActive = true + }.onError { + AppLog.put("朗读下载出错\n${it.localizedMessage}") }.onFinally { downloadTaskIsActive = false }