Intertal Player: Added MPD support (#402)

* added isDash in ExtractorLink
This commit is contained in:
PokerFace 2023-03-11 02:45:11 +07:00 committed by GitHub
parent e85b31c35d
commit 37244ab0f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View file

@ -1196,10 +1196,10 @@ class CS3IPlayer : IPlayer {
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.socketFactory)
}
val mime = if (link.isM3u8) {
MimeTypes.APPLICATION_M3U8
} else {
MimeTypes.VIDEO_MP4
val mime = when {
link.isM3u8 -> MimeTypes.APPLICATION_M3U8
link.isDash -> MimeTypes.APPLICATION_MPD
else -> MimeTypes.VIDEO_MP4
}
val mediaItems = if (link is ExtractorLinkPlayList) {
@ -1249,4 +1249,4 @@ class CS3IPlayer : IPlayer {
loadOfflinePlayer(context, it)
}
}
}
}

View file

@ -52,7 +52,7 @@ data class ExtractorLinkPlayList(
)
open class ExtractorLink(
open class ExtractorLink constructor(
open val source: String,
open val name: String,
override val url: String,
@ -62,7 +62,24 @@ open class ExtractorLink(
override val headers: Map<String, String> = mapOf(),
/** Used for getExtractorVerifierJob() */
open val extractorData: String? = null,
open val isDash: Boolean = false,
) : VideoDownloadManager.IDownloadableMinimum {
/**
* Old constructor without isDash, allows for backwards compatibility with extensions.
* Should be removed after all extensions have updated their cloudstream.jar
**/
constructor(
source: String,
name: String,
url: String,
referer: String,
quality: Int,
isM3u8: Boolean = false,
headers: Map<String, String> = mapOf(),
/** Used for getExtractorVerifierJob() */
extractorData: String? = null
) : this(source, name, url, referer, quality, isM3u8, headers, extractorData, false)
override fun toString(): String {
return "ExtractorLink(name=$name, url=$url, referer=$referer, isM3u8=$isM3u8)"
}