File tree Expand file tree Collapse file tree 7 files changed +30
-7
lines changed
ui/src/main/java/com/theoplayer/android/ui Expand file tree Collapse file tree 7 files changed +30
-7
lines changed Original file line number Diff line number Diff line change 9
9
> - 🏠 Internal
10
10
> - 💅 Polish
11
11
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
+
12
20
## v1.9.0 (2024-09-10)
13
21
14
22
* 💥 Updated to Jetpack Compose version 1.7.0 ([ BOM] ( https://developer.android.com/jetpack/compose/bom ) 2024.09.00).
Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ android.nonTransitiveRClass=true
24
24
android.nonFinalResIds =true
25
25
org.gradle.configuration-cache =true
26
26
# The version of the THEOplayer Open Video UI for Android.
27
- version =1.9.0
27
+ version =1.9.1
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ fun CurrentTimeDisplay(
21
21
) {
22
22
val player = Player .current
23
23
val currentTime = player?.currentTime ? : 0.0
24
- val duration = player?.duration ? : Double .NaN
24
+ val duration = player?.seekable?.lastEnd ? : player?. duration ? : Double .NaN
25
25
26
26
val time = if (showRemaining) {
27
27
- (duration - currentTime)
Original file line number Diff line number Diff line change @@ -112,7 +112,12 @@ fun DefaultUI(
112
112
Row (verticalAlignment = Alignment .CenterVertically ) {
113
113
MuteButton ()
114
114
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
+ }
116
121
Spacer (modifier = Modifier .weight(1f ))
117
122
FullscreenButton ()
118
123
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fun DurationDisplay(
14
14
modifier : Modifier = Modifier
15
15
) {
16
16
val player = Player .current
17
- val duration = player?.duration ? : Double .NaN
17
+ val duration = player?.seekable?.lastEnd ? : player?. duration ? : Double .NaN
18
18
19
19
Text (modifier = modifier, text = formatTime(duration))
20
20
}
Original file line number Diff line number Diff line change @@ -48,11 +48,11 @@ fun MenuScope.LanguageMenu() {
48
48
}
49
49
}
50
50
51
- private fun showAudioTracks (player : Player ? ): Boolean {
51
+ internal fun showAudioTracks (player : Player ? ): Boolean {
52
52
return player != null && player.audioTracks.size >= 2
53
53
}
54
54
55
- private fun showSubtitleTracks (player : Player ? ): Boolean {
55
+ internal fun showSubtitleTracks (player : Player ? ): Boolean {
56
56
return player != null && player.subtitleTracks.isNotEmpty()
57
57
}
58
58
Original file line number Diff line number Diff line change @@ -25,10 +25,20 @@ fun MenuScope.LanguageMenuButton(
25
25
)
26
26
}
27
27
) {
28
+ val player = Player .current
29
+ if (! showLanguageMenuButton(player)) {
30
+ // Hide when no alternative audio or subtitle tracks are available
31
+ return
32
+ }
33
+
28
34
IconButton (
29
35
modifier = modifier,
30
36
contentPadding = contentPadding,
31
37
onClick = { openMenu { LanguageMenu () } }) {
32
38
content()
33
39
}
34
- }
40
+ }
41
+
42
+ internal fun showLanguageMenuButton (player : Player ? ): Boolean {
43
+ return showAudioTracks(player) || showSubtitleTracks(player)
44
+ }
You can’t perform that action at this time.
0 commit comments