From b94312b3e17c612f81fec3d32f4d9dfc7952e4b5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 5 Sep 2021 23:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ---- app/src/main/java/io/legado/app/model/AudioPlay.kt | 4 ++-- .../java/io/legado/app/service/AudioPlayService.kt | 11 +++++------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1ec179663..35a454b51 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/io/legado/app/model/AudioPlay.kt b/app/src/main/java/io/legado/app/model/AudioPlay.kt index f668067c2..a850301fc 100644 --- a/app/src/main/java/io/legado/app/model/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/model/AudioPlay.kt @@ -25,8 +25,8 @@ object AudioPlay { var bookSource: BookSource? = null val loadingChapters = arrayListOf() - fun headers(): Map? { - return bookSource?.getHeaderMap() + fun headers(hasLoginHeader: Boolean): Map? { + return bookSource?.getHeaderMap(hasLoginHeader) } /** diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 332a5b1e2..332343feb 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -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)