Skip to content

Commit

Permalink
perf(PlayerControls): move instant seek zones hiding task to a Launch…
Browse files Browse the repository at this point in the history
…edEffect block
  • Loading branch information
urFate committed Apr 23, 2024
1 parent 6e1a1b5 commit 5f47304
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,16 @@ fun InstantSeekZones(
) {
val deviceWidth = LocalConfiguration.current.screenWidthDp.dp

var showRewindUi by remember {
mutableStateOf(false)
var showRewindUi by remember { mutableStateOf(false) }
var showForwardUi by remember { mutableStateOf(false) }

LaunchedEffect(showRewindUi) {
if(showRewindUi) delay(1000L).let { showRewindUi = false }
}
var showForwardUi by remember {
mutableStateOf(false)
LaunchedEffect(showForwardUi) {
if(showForwardUi) delay(1000L).let { showForwardUi = false }
}

val coroutineScope = rememberCoroutineScope()

// Rewind seek zone
SeekZoneBox(
modifier = Modifier
Expand All @@ -449,9 +450,6 @@ fun InstantSeekZones(
onDoubleClick = {
onFastRewind(it)
showRewindUi = true
coroutineScope.launch {
delay(1000L).let { showRewindUi = false }
}
},
onClick = onClick
)
Expand All @@ -465,9 +463,6 @@ fun InstantSeekZones(
onDoubleClick = {
onFastForward(it)
showForwardUi = true
coroutineScope.launch {
delay(1000L).let { showForwardUi = false }
}
},
onClick = onClick
)
Expand Down

0 comments on commit 5f47304

Please sign in to comment.