pull/1298/head
gedoor 3 years ago
parent 53e9c499a4
commit b94312b3e1
  1. 4
      app/build.gradle
  2. 4
      app/src/main/java/io/legado/app/model/AudioPlay.kt
  3. 11
      app/src/main/java/io/legado/app/service/AudioPlayService.kt

@ -153,10 +153,6 @@ dependencies {
def exoplayer_version = '2.15.0'
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer_version"
// implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayer_version"
// implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayer_version"
// implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
// implementation "com.google.android.exoplayer:exoplayer-rtsp:$exoplayer_version"
//Splitties
def splitties_version = '2.1.1'

@ -25,8 +25,8 @@ object AudioPlay {
var bookSource: BookSource? = null
val loadingChapters = arrayListOf<Int>()
fun headers(): Map<String, String>? {
return bookSource?.getHeaderMap()
fun headers(hasLoginHeader: Boolean): Map<String, String>? {
return bookSource?.getHeaderMap(hasLoginHeader)
}
/**

@ -125,12 +125,11 @@ class AudioPlayService : BaseService(),
AudioPlay.status = Status.STOP
postEvent(EventBus.AUDIO_STATE, Status.STOP)
upPlayProgressJob?.cancel()
val analyzeUrl =
AnalyzeUrl(
url,
headerMapF = AudioPlay.headers(),
source = AudioPlay.bookSource
)
val analyzeUrl = AnalyzeUrl(
url,
headerMapF = AudioPlay.headers(true),
source = AudioPlay.bookSource
)
val uri = Uri.parse(analyzeUrl.getDirectUrl())
val mediaSource = ExoPlayerHelper
.createMediaSource(uri, analyzeUrl.headerMap)

Loading…
Cancel
Save