This commit is contained in:
gedoor 2021-09-05 23:02:37 +08:00
parent 53e9c499a4
commit b94312b3e1
3 changed files with 7 additions and 12 deletions

View File

@ -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'

View File

@ -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)
}
/**

View File

@ -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)