@@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Box
66import androidx.compose.foundation.layout.fillMaxWidth
77import androidx.compose.material3.Icon
88import androidx.compose.material3.IconButton
9+ import androidx.compose.material3.Slider
910import androidx.compose.runtime.Composable
1011import androidx.compose.runtime.DisposableEffect
1112import androidx.compose.runtime.derivedStateOf
@@ -20,6 +21,7 @@ import androidx.compose.ui.res.painterResource
2021import androidx.compose.ui.res.stringResource
2122import androidx.compose.ui.viewinterop.AndroidView
2223import androidx.media3.common.MediaItem
24+ import androidx.media3.common.Player
2325import androidx.media3.exoplayer.ExoPlayer
2426import androidx.media3.ui.PlayerView
2527import com.codandotv.streamplayerapp.core.shared.ui.R
@@ -38,6 +40,16 @@ fun PlayerComponent(url: String, modifier: Modifier = Modifier) {
3840 mutableStateOf(true )
3941 }
4042
43+ val playerControlData by remember {
44+ derivedStateOf {
45+ if (isPlayerPlaying) {
46+ PlayerIconData (R .drawable.ic_pause, R .string.player_pause)
47+ } else {
48+ PlayerIconData (R .drawable.ic_play, R .string.player_continue)
49+ }
50+ }
51+ }
52+
4153 val exoplayer = remember {
4254 val mediaItem = MediaItem .Builder ()
4355 .setUri(url)
@@ -48,19 +60,17 @@ fun PlayerComponent(url: String, modifier: Modifier = Modifier) {
4860 prepare()
4961
5062 playWhenReady = true
51- }
52- }
5363
54- val playerControlData by remember {
55- derivedStateOf {
56- if (isPlayerPlaying) {
57- PlayerIconData (R .drawable.ic_pause, R .string.player_pause)
58- } else {
59- PlayerIconData (R .drawable.ic_play, R .string.player_continue)
60- }
64+ addListener(object : Player .Listener {
65+ override fun onIsPlayingChanged (isPlaying : Boolean ) {
66+ isPlayerPlaying = isPlaying
67+ }
68+ })
6169 }
6270 }
6371
72+ var playerProgress = remember { mutableStateOf(0f ) }
73+
6474 Box (modifier = modifier) {
6575 AndroidView (
6676 modifier = Modifier
@@ -82,15 +92,21 @@ fun PlayerComponent(url: String, modifier: Modifier = Modifier) {
8292 } else {
8393 exoplayer.play()
8494 }
85-
86- isPlayerPlaying = isPlayerPlaying.not ()
8795 }
8896 ) {
8997 Icon (
9098 painter = painterResource(id = playerControlData.iconRes),
9199 contentDescription = stringResource(id = playerControlData.contentDescriptionRes)
92100 )
93101 }
102+
103+ Slider (
104+ modifier = Modifier
105+ .fillMaxWidth()
106+ .align(Alignment .BottomCenter ),
107+ value = 0.5f ,
108+ onValueChange = {}
109+ )
94110 }
95111
96112 DisposableEffect (key1 = Unit , effect = {
0 commit comments