pull/1344/head
gedoor 3 years ago
parent ab13bcca05
commit d36a59ad12
  1. 7
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
  2. 5
      app/src/main/java/io/legado/app/service/TTSReadAloudService.kt

@ -24,15 +24,16 @@ class HttpReadAloudService : BaseReadAloudService(),
MediaPlayer.OnErrorListener, MediaPlayer.OnErrorListener,
MediaPlayer.OnCompletionListener { MediaPlayer.OnCompletionListener {
private val mediaPlayer by lazy { MediaPlayer() } private val mediaPlayer = MediaPlayer()
private lateinit var ttsFolder: String private val ttsFolder: String by lazy {
externalCacheDir!!.absolutePath + File.separator + "httpTTS"
}
private var task: Coroutine<*>? = null private var task: Coroutine<*>? = null
private var playingIndex = -1 private var playingIndex = -1
private var playIndexJob: Job? = null private var playIndexJob: Job? = null
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
ttsFolder = externalCacheDir!!.absolutePath + File.separator + "httpTTS"
mediaPlayer.setOnErrorListener(this) mediaPlayer.setOnErrorListener(this)
mediaPlayer.setOnPreparedListener(this) mediaPlayer.setOnPreparedListener(this)
mediaPlayer.setOnCompletionListener(this) mediaPlayer.setOnCompletionListener(this)

@ -147,11 +147,6 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
} }
} }
override fun onAudioAvailable(utteranceId: String?, audio: ByteArray?) {
super.onAudioAvailable(utteranceId, audio)
}
override fun onError(s: String) { override fun onError(s: String) {
//nothing //nothing
} }

Loading…
Cancel
Save