@@ -14,7 +14,6 @@ import androidx.compose.runtime.derivedStateOf
1414import androidx.compose.runtime.getValue
1515import androidx.compose.runtime.mutableStateOf
1616import androidx.compose.runtime.remember
17- import androidx.compose.runtime.rememberCoroutineScope
1817import androidx.compose.runtime.setValue
1918import androidx.compose.ui.Alignment
2019import androidx.compose.ui.Modifier
@@ -29,7 +28,6 @@ import androidx.media3.ui.PlayerView
2928import com.codandotv.streamplayerapp.core.shared.ui.R
3029import com.codandotv.streamplayerapp.core_shared_ui.theme.ThemePreviews
3130import kotlinx.coroutines.delay
32- import kotlinx.coroutines.launch
3331
3432data class PlayerIconData (
3533 @DrawableRes val iconRes : Int ,
@@ -79,8 +77,6 @@ fun PlayerComponent(url: String, modifier: Modifier = Modifier) {
7977 derivedStateOf { (playerPosition / exoplayer.contentDuration.toDouble()).toFloat() }
8078 }
8179
82- val coroutineScope = rememberCoroutineScope()
83-
8480 Box (modifier = modifier) {
8581 AndroidView (
8682 modifier = Modifier
@@ -122,11 +118,9 @@ fun PlayerComponent(url: String, modifier: Modifier = Modifier) {
122118 LaunchedEffect (
123119 key1 = isPlayerPlaying,
124120 block = {
125- coroutineScope.launch {
126- while (isPlayerPlaying) {
127- delay(500L )
128- playerPosition + = 500L
129- }
121+ while (isPlayerPlaying) {
122+ delay(500L )
123+ playerPosition + = 500L
130124 }
131125 }
132126 )
0 commit comments