Skip to content

Commit 09c1fba

Browse files
Merge pull request #46 from THEOplayer/release/1.9.1
Release 1.9.1
2 parents f8a0439 + 7247074 commit 09c1fba

File tree

7 files changed

+30
-7
lines changed

7 files changed

+30
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
> - 🏠 Internal
1010
> - 💅 Polish
1111
12+
## v1.9.1 (2024-10-01)
13+
14+
* 🐛 Fix `DurationDisplay` to show the time of the live point when playing a live or DVR stream.
15+
* 🐛 Fix `CurrentTimeDisplay` to show the time offset to the live point when playing a live or DVR stream with `showRemaining = true`.
16+
* 💅 Changed `DefaultUi` to hide the current time display when playing a live stream.
17+
* 💅 Changed `DefaultUi` to show the time offset to the live point when playing a DVR stream.
18+
* 💅 Changed `LanguageMenuButton` to automatically hide itself when there are no alternative audio or subtitle tracks to select.
19+
1220
## v1.9.0 (2024-09-10)
1321

1422
* 💥 Updated to Jetpack Compose version 1.7.0 ([BOM](https://developer.android.com/jetpack/compose/bom) 2024.09.00).

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ android.nonTransitiveRClass=true
2424
android.nonFinalResIds=true
2525
org.gradle.configuration-cache=true
2626
# The version of the THEOplayer Open Video UI for Android.
27-
version=1.9.0
27+
version=1.9.1

ui/src/main/java/com/theoplayer/android/ui/CurrentTimeDisplay.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fun CurrentTimeDisplay(
2121
) {
2222
val player = Player.current
2323
val currentTime = player?.currentTime ?: 0.0
24-
val duration = player?.duration ?: Double.NaN
24+
val duration = player?.seekable?.lastEnd ?: player?.duration ?: Double.NaN
2525

2626
val time = if (showRemaining) {
2727
-(duration - currentTime)

ui/src/main/java/com/theoplayer/android/ui/DefaultUI.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ fun DefaultUI(
112112
Row(verticalAlignment = Alignment.CenterVertically) {
113113
MuteButton()
114114
LiveButton()
115-
CurrentTimeDisplay(showDuration = true)
115+
if (player.streamType != StreamType.Live) {
116+
CurrentTimeDisplay(
117+
showRemaining = player.streamType == StreamType.Dvr,
118+
showDuration = player.streamType == StreamType.Vod
119+
)
120+
}
116121
Spacer(modifier = Modifier.weight(1f))
117122
FullscreenButton()
118123
}

ui/src/main/java/com/theoplayer/android/ui/DurationDisplay.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fun DurationDisplay(
1414
modifier: Modifier = Modifier
1515
) {
1616
val player = Player.current
17-
val duration = player?.duration ?: Double.NaN
17+
val duration = player?.seekable?.lastEnd ?: player?.duration ?: Double.NaN
1818

1919
Text(modifier = modifier, text = formatTime(duration))
2020
}

ui/src/main/java/com/theoplayer/android/ui/LanguageMenu.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ fun MenuScope.LanguageMenu() {
4848
}
4949
}
5050

51-
private fun showAudioTracks(player: Player?): Boolean {
51+
internal fun showAudioTracks(player: Player?): Boolean {
5252
return player != null && player.audioTracks.size >= 2
5353
}
5454

55-
private fun showSubtitleTracks(player: Player?): Boolean {
55+
internal fun showSubtitleTracks(player: Player?): Boolean {
5656
return player != null && player.subtitleTracks.isNotEmpty()
5757
}
5858

ui/src/main/java/com/theoplayer/android/ui/LanguageMenuButton.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@ fun MenuScope.LanguageMenuButton(
2525
)
2626
}
2727
) {
28+
val player = Player.current
29+
if (!showLanguageMenuButton(player)) {
30+
// Hide when no alternative audio or subtitle tracks are available
31+
return
32+
}
33+
2834
IconButton(
2935
modifier = modifier,
3036
contentPadding = contentPadding,
3137
onClick = { openMenu { LanguageMenu() } }) {
3238
content()
3339
}
34-
}
40+
}
41+
42+
internal fun showLanguageMenuButton(player: Player?): Boolean {
43+
return showAudioTracks(player) || showSubtitleTracks(player)
44+
}

0 commit comments

Comments
 (0)