This commit is contained in:
Horis 2024-03-05 17:04:06 +08:00
parent c562c40689
commit 29c4d63c32

View File

@ -376,17 +376,16 @@ class HttpReadAloudService : BaseReadAloudService(),
AppLog.put("朗读连续5次错误, 最后一次错误代码(${error.localizedMessage})", error) AppLog.put("朗读连续5次错误, 最后一次错误代码(${error.localizedMessage})", error)
pauseReadAloud() pauseReadAloud()
} else { } else {
deleteCurrentSpeakFile() if (exoPlayer.hasNextMediaItem()) {
downloadAndPlayAudios() exoPlayer.seekToNextMediaItem()
exoPlayer.playWhenReady = true
exoPlayer.prepare()
} else {
updateNextPos()
}
} }
} }
private fun deleteCurrentSpeakFile() {
val mediaItem = exoPlayer.currentMediaItem ?: return
val filePath = mediaItem.localConfiguration!!.uri.path!!
File(filePath).delete()
}
override fun aloudServicePendingIntent(actionStr: String): PendingIntent? { override fun aloudServicePendingIntent(actionStr: String): PendingIntent? {
return servicePendingIntent<HttpReadAloudService>(actionStr) return servicePendingIntent<HttpReadAloudService>(actionStr)
} }