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

Loading…
Cancel
Save