@ -156,13 +156,9 @@ abstract class BaseReadAloudService : BaseService(),
@CallSuper
open fun resumeReadAloud() {
pause = false
if (contentList.isEmpty()) {
ReadBook.readAloud()
} else {
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING)
postEvent(EventBus.ALOUD_STATE, Status.PLAY)
}
abstract fun upSpeechRate(reset: Boolean = false)
@ -63,7 +63,9 @@ class HttpReadAloudService : BaseReadAloudService(),
override fun play() {
if (contentList.isEmpty()) return
ReadAloud.httpTTS?.let {
val fileName =
md5SpeakFileName(it.url, AppConfig.ttsSpeechRate.toString(), contentList[nowSpeak])
@ -79,6 +81,7 @@ class HttpReadAloudService : BaseReadAloudService(),
override fun playStop() {
mediaPlayer.stop()
@ -65,7 +65,11 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
@Synchronized
if (contentList.isNotEmpty() && ttsInitFinish && requestFocus()) {
if (!ttsInitFinish) return
if (!requestFocus()) return
super.play()
execute {
MediaHelp.playSilentSound(this@TTSReadAloudService)