|
|
|
@ -12,6 +12,7 @@ import io.legado.app.utils.getPrefString |
|
|
|
|
import io.legado.app.utils.postEvent |
|
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
|
import kotlinx.coroutines.Job |
|
|
|
|
import kotlinx.coroutines.isActive |
|
|
|
|
import kotlinx.coroutines.launch |
|
|
|
|
import org.jetbrains.anko.toast |
|
|
|
|
import java.io.File |
|
|
|
@ -81,6 +82,7 @@ class HttpReadAloudService : BaseReadAloudService(), |
|
|
|
|
job = launch(IO) { |
|
|
|
|
FileHelp.deleteFile(ttsFolder) |
|
|
|
|
for (index in 0 until contentList.size) { |
|
|
|
|
if (isActive) { |
|
|
|
|
val bytes = HttpHelper.getByteRetrofit("http://tts.baidu.com") |
|
|
|
|
.create(IHttpPostApi::class.java) |
|
|
|
|
.postMapByte( |
|
|
|
@ -100,6 +102,7 @@ class HttpReadAloudService : BaseReadAloudService(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
|
private fun playAudio(fd: FileDescriptor) { |
|
|
|
|