|
|
@ -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) |
|
|
|