pull/63/head
kunfei 5 years ago
parent d9e2f979ae
commit a2235ca21d
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  2. 7
      app/src/main/java/io/legado/app/service/AudioPlayService.kt

@ -117,7 +117,7 @@ class AnalyzeUrl(
page?.let {
val matcher = pagePattern.matcher(ruleUrl)
while (matcher.find()) {
val pages = matcher.group(1).split(",")
val pages = matcher.group(1)!!.split(",")
ruleUrl = if (page <= pages.size) {
ruleUrl.replace(matcher.group(), pages[page - 1].trim { it <= ' ' })
} else {

@ -26,6 +26,7 @@ import io.legado.app.data.entities.BookChapter
import io.legado.app.help.BookHelp
import io.legado.app.help.IntentHelp
import io.legado.app.help.MediaHelp
import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.receiver.MediaButtonReceiver
import io.legado.app.service.help.AudioPlay
import io.legado.app.ui.audio.AudioPlayActivity
@ -121,8 +122,10 @@ class AudioPlayService : BaseService(),
AudioPlay.status = Status.PLAY
postEvent(Bus.AUDIO_STATE, Status.PLAY)
mediaPlayer.reset()
val uri = Uri.parse(url)
mediaPlayer.setDataSource(this, uri, AudioPlay.headers())
val analyzeUrl =
AnalyzeUrl(url, headerMapF = AudioPlay.headers(), useWebView = true)
val uri = Uri.parse(analyzeUrl.url)
mediaPlayer.setDataSource(this, uri, analyzeUrl.headerMap)
mediaPlayer.prepareAsync()
} catch (e: Exception) {
launch {

Loading…
Cancel
Save