Skip to content

Commit

Permalink
Merge pull request #46 from THEOplayer/release/1.9.1
Browse files Browse the repository at this point in the history
Release 1.9.1
  • Loading branch information
MattiasBuelens authored Oct 1, 2024
2 parents f8a0439 + 7247074 commit 09c1fba
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
> - 🏠 Internal
> - 💅 Polish
## v1.9.1 (2024-10-01)

* 🐛 Fix `DurationDisplay` to show the time of the live point when playing a live or DVR stream.
* 🐛 Fix `CurrentTimeDisplay` to show the time offset to the live point when playing a live or DVR stream with `showRemaining = true`.
* 💅 Changed `DefaultUi` to hide the current time display when playing a live stream.
* 💅 Changed `DefaultUi` to show the time offset to the live point when playing a DVR stream.
* 💅 Changed `LanguageMenuButton` to automatically hide itself when there are no alternative audio or subtitle tracks to select.

## v1.9.0 (2024-09-10)

* 💥 Updated to Jetpack Compose version 1.7.0 ([BOM](https://developer.android.com/jetpack/compose/bom) 2024.09.00).
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ android.nonTransitiveRClass=true
android.nonFinalResIds=true
org.gradle.configuration-cache=true
# The version of the THEOplayer Open Video UI for Android.
version=1.9.0
version=1.9.1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fun CurrentTimeDisplay(
) {
val player = Player.current
val currentTime = player?.currentTime ?: 0.0
val duration = player?.duration ?: Double.NaN
val duration = player?.seekable?.lastEnd ?: player?.duration ?: Double.NaN

val time = if (showRemaining) {
-(duration - currentTime)
Expand Down
7 changes: 6 additions & 1 deletion ui/src/main/java/com/theoplayer/android/ui/DefaultUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ fun DefaultUI(
Row(verticalAlignment = Alignment.CenterVertically) {
MuteButton()
LiveButton()
CurrentTimeDisplay(showDuration = true)
if (player.streamType != StreamType.Live) {
CurrentTimeDisplay(
showRemaining = player.streamType == StreamType.Dvr,
showDuration = player.streamType == StreamType.Vod
)
}
Spacer(modifier = Modifier.weight(1f))
FullscreenButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun DurationDisplay(
modifier: Modifier = Modifier
) {
val player = Player.current
val duration = player?.duration ?: Double.NaN
val duration = player?.seekable?.lastEnd ?: player?.duration ?: Double.NaN

Text(modifier = modifier, text = formatTime(duration))
}
4 changes: 2 additions & 2 deletions ui/src/main/java/com/theoplayer/android/ui/LanguageMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ fun MenuScope.LanguageMenu() {
}
}

private fun showAudioTracks(player: Player?): Boolean {
internal fun showAudioTracks(player: Player?): Boolean {
return player != null && player.audioTracks.size >= 2
}

private fun showSubtitleTracks(player: Player?): Boolean {
internal fun showSubtitleTracks(player: Player?): Boolean {
return player != null && player.subtitleTracks.isNotEmpty()
}

Expand Down
12 changes: 11 additions & 1 deletion ui/src/main/java/com/theoplayer/android/ui/LanguageMenuButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ fun MenuScope.LanguageMenuButton(
)
}
) {
val player = Player.current
if (!showLanguageMenuButton(player)) {
// Hide when no alternative audio or subtitle tracks are available
return
}

IconButton(
modifier = modifier,
contentPadding = contentPadding,
onClick = { openMenu { LanguageMenu() } }) {
content()
}
}
}

internal fun showLanguageMenuButton(player: Player?): Boolean {
return showAudioTracks(player) || showSubtitleTracks(player)
}

0 comments on commit 09c1fba

Please sign in to comment.