pull/1817/head
kunfei 3 years ago
parent 0bdf3eae54
commit fb0acad6ff
  1. 6
      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
}

Loading…
Cancel
Save