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) HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.socketFactory)
} }
val mime = if (link.isM3u8) { val mime = when {
MimeTypes.APPLICATION_M3U8 link.isM3u8 -> MimeTypes.APPLICATION_M3U8
} else { link.isDash -> MimeTypes.APPLICATION_MPD
MimeTypes.VIDEO_MP4 else -> MimeTypes.VIDEO_MP4
} }
val mediaItems = if (link is ExtractorLinkPlayList) { val mediaItems = if (link is ExtractorLinkPlayList) {
@ -1249,4 +1249,4 @@ class CS3IPlayer : IPlayer {
loadOfflinePlayer(context, it) 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 source: String,
open val name: String, open val name: String,
override val url: String, override val url: String,
@ -62,7 +62,24 @@ open class ExtractorLink(
override val headers: Map<String, String> = mapOf(), override val headers: Map<String, String> = mapOf(),
/** Used for getExtractorVerifierJob() */ /** Used for getExtractorVerifierJob() */
open val extractorData: String? = null, open val extractorData: String? = null,
open val isDash: Boolean = false,
) : VideoDownloadManager.IDownloadableMinimum { ) : 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 { override fun toString(): String {
return "ExtractorLink(name=$name, url=$url, referer=$referer, isM3u8=$isM3u8)" return "ExtractorLink(name=$name, url=$url, referer=$referer, isM3u8=$isM3u8)"
} }