Skip to content

Commit 721fd43

Browse files
committed
[ISSUE-68] - Removing unnecessary coroutineContext
1 parent 8548fd6 commit 721fd43

File tree

1 file changed

+3
-9
lines changed
  • core-shared-ui/src/main/java/com/codandotv/streamplayerapp/core_shared_ui/widget

1 file changed

+3
-9
lines changed

core-shared-ui/src/main/java/com/codandotv/streamplayerapp/core_shared_ui/widget/PlayerComponent.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import androidx.compose.runtime.derivedStateOf
1414
import androidx.compose.runtime.getValue
1515
import androidx.compose.runtime.mutableStateOf
1616
import androidx.compose.runtime.remember
17-
import androidx.compose.runtime.rememberCoroutineScope
1817
import androidx.compose.runtime.setValue
1918
import androidx.compose.ui.Alignment
2019
import androidx.compose.ui.Modifier
@@ -29,7 +28,6 @@ import androidx.media3.ui.PlayerView
2928
import com.codandotv.streamplayerapp.core.shared.ui.R
3029
import com.codandotv.streamplayerapp.core_shared_ui.theme.ThemePreviews
3130
import kotlinx.coroutines.delay
32-
import kotlinx.coroutines.launch
3331

3432
data 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

Comments
 (0)