diff --git a/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt index 52a26d545..663c9692c 100644 --- a/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt +++ b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt @@ -7,7 +7,7 @@ import kotlin.io.path.Path @Serializable data class PipedStream( - val url: String? = null, + var url: String? = null, val format: String? = null, val quality: String? = null, val mimeType: String? = null, diff --git a/app/src/main/java/com/github/libretube/helpers/DashHelper.kt b/app/src/main/java/com/github/libretube/helpers/DashHelper.kt index 0d2c8c022..7b054afbd 100644 --- a/app/src/main/java/com/github/libretube/helpers/DashHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/DashHelper.kt @@ -40,17 +40,25 @@ object DashHelper { val adapSetInfos = ArrayList() - for ( - stream in streams.videoStreams + for (stream in streams.videoStreams) { // used to avoid including LBRY HLS inside the streams in the manifest - .filter { !it.format.orEmpty().contains("HLS") } - .filter { supportsHdr || !it.quality.orEmpty().uppercase().contains("HDR") } - ) { + if (stream.format.orEmpty().contains("HLS")) { + continue + } + + // HDR is only supported by some new devices + if (!supportsHdr && stream.quality.orEmpty().uppercase().contains("HDR")) { + continue + } + // ignore dual format and OTF streams if (!stream.videoOnly!! || stream.indexEnd!! <= 0) { continue } + // only unwraps the url if the preference is set in the settings + stream.url = ProxyHelper.unwrapStreamUrl(stream.url.orEmpty()) + val adapSetInfo = adapSetInfos.find { it.mimeType == stream.mimeType } if (adapSetInfo != null) { adapSetInfo.formats.add(stream) @@ -73,6 +81,10 @@ object DashHelper { adapSetInfo.formats.add(stream) continue } + + // only unwraps the url if the preference is set in the settings + stream.url = ProxyHelper.unwrapStreamUrl(stream.url.orEmpty()) + adapSetInfos.add( AdapSetInfo( stream.mimeType!!,