fix quality on chromecast

This commit is contained in:
LagradOst 2022-05-06 13:55:56 +02:00
parent c37a552ebf
commit 659d146dfe
5 changed files with 7 additions and 12 deletions

View file

@ -36,6 +36,7 @@ import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.DataStore.toKotlinObject import com.lagradost.cloudstream3.utils.DataStore.toKotlinObject
import com.lagradost.cloudstream3.utils.DataStoreHelper import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import org.json.JSONObject import org.json.JSONObject
@ -182,7 +183,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
val contentUrl = (remoteMediaClient?.currentItem?.media?.contentUrl val contentUrl = (remoteMediaClient?.currentItem?.media?.contentUrl
?: remoteMediaClient?.currentItem?.media?.contentId) ?: remoteMediaClient?.currentItem?.media?.contentId)
val sortingMethods = items.map { it.name }.toTypedArray() val sortingMethods = items.map { "${it.name} ${Qualities.getStringByInt(it.quality)}" }.toTypedArray()
val sotringIndex = items.indexOfFirst { it.url == contentUrl } val sotringIndex = items.indexOfFirst { it.url == contentUrl }
val arrayAdapter = val arrayAdapter =

View file

@ -48,7 +48,6 @@ class CS3IPlayer : IPlayer {
private val seekActionTime = 30000L private val seekActionTime = 30000L
private var ignoreSSL: Boolean = true private var ignoreSSL: Boolean = true
private var simpleCache: SimpleCache? = null
private var playBackSpeed: Float = 1.0f private var playBackSpeed: Float = 1.0f
private var lastMuteVolume: Float = 1.0f private var lastMuteVolume: Float = 1.0f
@ -306,6 +305,8 @@ class CS3IPlayer : IPlayer {
} }
companion object { companion object {
private var simpleCache: SimpleCache? = null
var requestSubtitleUpdate: (() -> Unit)? = null var requestSubtitleUpdate: (() -> Unit)? = null
private fun createOnlineSource(link: ExtractorLink): DataSource.Factory { private fun createOnlineSource(link: ExtractorLink): DataSource.Factory {

View file

@ -872,7 +872,6 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
) )
} }
suspend fun requireLinks(isCasting: Boolean, displayLoading: Boolean = true): Boolean { suspend fun requireLinks(isCasting: Boolean, displayLoading: Boolean = true): Boolean {
val skipLoading = getApiFromName(apiName).instantLinkLoading val skipLoading = getApiFromName(apiName).instantLinkLoading

View file

@ -30,9 +30,9 @@ object CastHelper {
movieMetadata.putString( movieMetadata.putString(
MediaMetadata.KEY_SUBTITLE, MediaMetadata.KEY_SUBTITLE,
if (holder.isMovie) if (holder.isMovie)
link.name "${link.name} ${Qualities.getStringByInt(link.quality)}"
else else
(epData.name ?: "Episode ${epData.episode}") + " - ${link.name}" (epData.name ?: "Episode ${epData.episode}") + " - ${link.name} ${Qualities.getStringByInt(link.quality)}"
) )
holder.title?.let { holder.title?.let {

View file

@ -1113,13 +1113,7 @@ object VideoDownloadManager {
logcatPrint("initialised the HLS downloader.") logcatPrint("initialised the HLS downloader.")
val m3u8 = M3u8Helper.M3u8Stream( val m3u8 = M3u8Helper.M3u8Stream(
link.url, when (link.quality) { link.url, link.quality, mapOf("referer" to link.referer)
-2 -> 360
-1 -> 480
1 -> 720
2 -> 1080
else -> null
}, mapOf("referer" to link.referer)
) )
var realIndex = startIndex ?: 0 var realIndex = startIndex ?: 0