diff --git a/app/src/main/java/com/lagradost/cloudstream3/actions/temp/CloudStreamPackage.kt b/app/src/main/java/com/lagradost/cloudstream3/actions/temp/CloudStreamPackage.kt index d414b611783..f9036ba58b0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/actions/temp/CloudStreamPackage.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/actions/temp/CloudStreamPackage.kt @@ -22,7 +22,10 @@ import com.lagradost.cloudstream3.utils.newExtractorLink import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.SubtitleHelper.fromCodeToLangTagIETF import com.lagradost.cloudstream3.utils.SubtitleHelper.fromLanguageToTagIETF +import com.lagradost.cloudstream3.utils.serializers.UriSerializer import com.lagradost.cloudstream3.utils.txt +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * If you want to support CloudStream 3 as an external player, then this shows how to play any video link @@ -49,19 +52,16 @@ class CloudStreamPackage : OpenInAppAction( const val DURATION_EXTRA: String = "dur" // Duration time in MS (Long) } + @Serializable data class MinimalVideoLink( - @JsonProperty("uri") + @JsonProperty("uri") @SerialName("uri") + @Serializable(with = UriSerializer::class) val uri: Uri?, - @JsonProperty("url") - val url: String?, - @JsonProperty("mimeType") - val mimeType: String = "video/mp4", - @JsonProperty("name") - val name: String?, - @JsonProperty("headers") - var headers: Map = mapOf(), - @JsonProperty("quality") - val quality: Int?, + @JsonProperty("url") @SerialName("url") val url: String?, + @JsonProperty("mimeType") @SerialName("mimeType") val mimeType: String = "video/mp4", + @JsonProperty("name") @SerialName("name") val name: String?, + @JsonProperty("headers") @SerialName("headers") var headers: Map = mapOf(), + @JsonProperty("quality") @SerialName("quality") val quality: Int?, ) { companion object { fun fromExtractor(link: ExtractorLink): MinimalVideoLink = MinimalVideoLink( @@ -97,16 +97,12 @@ class CloudStreamPackage : OpenInAppAction( } } - + @Serializable data class MinimalSubtitleLink( - @JsonProperty("url") - val url: String, - @JsonProperty("mimeType") - val mimeType: String = "text/vtt", - @JsonProperty("name") - val name: String?, - @JsonProperty("headers") - var headers: Map = mapOf(), + @JsonProperty("url") @SerialName("url") val url: String, + @JsonProperty("mimeType") @SerialName("mimeType") val mimeType: String = "text/vtt", + @JsonProperty("name") @SerialName("name") val name: String?, + @JsonProperty("headers") @SerialName("headers") var headers: Map = mapOf(), ) { companion object { fun fromSubtitle(sub: SubtitleData): MinimalSubtitleLink = MinimalSubtitleLink( @@ -159,4 +155,4 @@ class CloudStreamPackage : OpenInAppAction( override fun onResult(activity: Activity, intent: Intent?) { // No results yet } -} \ No newline at end of file +}