pull/90/head^2
kunfei 5 years ago
parent e993d710f6
commit b2339ed043
  1. 5
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

@ -94,11 +94,11 @@ class HttpReadAloudService : BaseReadAloudService(),
@Synchronized @Synchronized
private fun playAudio(fd: FileDescriptor) { private fun playAudio(fd: FileDescriptor) {
if (playingIndex != nowSpeak && requestFocus()) { if (playingIndex != nowSpeak && requestFocus()) {
playingIndex = nowSpeak
try { try {
mediaPlayer.reset() mediaPlayer.reset()
mediaPlayer.setDataSource(fd) mediaPlayer.setDataSource(fd)
mediaPlayer.prepareAsync() mediaPlayer.prepareAsync()
playingIndex = nowSpeak
postEvent(EventBus.TTS_START, readAloudNumber + 1) postEvent(EventBus.TTS_START, readAloudNumber + 1)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
@ -154,9 +154,8 @@ class HttpReadAloudService : BaseReadAloudService(),
*/ */
override fun upSpeechRate(reset: Boolean) { override fun upSpeechRate(reset: Boolean) {
job?.cancel() job?.cancel()
if (mediaPlayer.isPlaying) {
mediaPlayer.stop() mediaPlayer.stop()
} playingIndex = -1
downloadAudio() downloadAudio()
} }

Loading…
Cancel
Save