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' def exoplayer_version = '2.15.0'
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version" implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:extension-okhttp:$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 //Splitties
def splitties_version = '2.1.1' def splitties_version = '2.1.1'

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

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

Loading…
Cancel
Save