Skip to content

Commit

Permalink
update: Added a 'Default' rendition order
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em committed May 8, 2024
1 parent ca48381 commit 34571c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion library/src/main/java/com/mux/player/media/MediaItems.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ object MediaItems {

minResolution?.let { base.appendQueryParameter("min_resolution", resolutionValue(it)) }
maxResolution?.let { base.appendQueryParameter("max_resolution", resolutionValue(it)) }
renditionOrder?.let { base.appendQueryParameter("rendition_order", resolutionValue(it)) }
renditionOrder?.takeIf { it != RenditionOrder.Default }
?.let { base.appendQueryParameter("rendition_order", resolutionValue(it)) }
playbackToken?.let { base.appendQueryParameter("token", it) }

base.appendQueryParameter("redundant_streams", "true");
Expand All @@ -133,6 +134,7 @@ object MediaItems {
private fun resolutionValue(renditionOrder: RenditionOrder): String {
return when (renditionOrder) {
RenditionOrder.Descending -> "desc"
else -> "" // should be avoided by createPlaybackUrl
}
}

Expand Down Expand Up @@ -170,4 +172,9 @@ enum class RenditionOrder {
* setting emphasizes video quality, but may lead to more interruptions on unfavorable networks
*/
Descending,

/**
* The default rendition order will be used, which may be optimized for delivery
*/
Default,
}

0 comments on commit 34571c4

Please sign in to comment.