Update M3u8Helper.kt

This commit is contained in:
Arjix 2021-09-01 17:34:31 +03:00 committed by GitHub
parent b78fdcdce4
commit 620c11d68f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,7 +118,12 @@ class M3u8Helper {
)
public fun hlsYield(qualities: List<M3u8Stream>): Iterator<HlsDownloadData> {
val selected = selectBest(qualities)!!
if (qualities.isEmpty()) return listOf<HlsDownloadData>().iterator()
var selected = selectBest(qualities)
if (selected == null) {
selected = qualities[0]
}
val headers = selected.headers
val streams = qualities.map { m3u8Generation(it) }.flatten()
@ -136,7 +141,7 @@ class M3u8Helper {
val encryptionState = isEncrypted(m3u8Data)
if (encryptionState) {
val match = ENCRYPTION_URL_IV_REGEX.find(m3u8Data)!!.destructured
val match = ENCRYPTION_URL_IV_REGEX.find(m3u8Data)!!.destructured // its safe to assume that its not going to be null
encryptionUri = match.component2()
if (!isCompleteUrl(encryptionUri)) {