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