feat: Add some optional delay to RecordingControl

This commit is contained in:
Myzel394 2023-12-17 21:27:47 +01:00
parent 76752e9004
commit e719c0f8fb
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
2 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import kotlinx.coroutines.launch
@Composable
fun RecordingControl(
initialDelay: Long = 0L,
isPaused: Boolean,
recordingTime: Long,
onDelete: () -> Unit,
@ -67,6 +68,8 @@ fun RecordingControl(
LaunchedEffect(animateIn) {
if (animateIn) {
delay(initialDelay)
val stack = RandomStack.of(arrayOf(1, 2, 3).asIterable())
while (!stack.isEmpty()) {

View File

@ -142,6 +142,10 @@ fun VideoRecordingStatus(
if (!videoRecorder.isStartingRecording) {
RecordingControl(
// There may be some edge cases where the app may crash if the
// user stops or pauses the recording too soon, so we simply add a
// small delay to prevent that
initialDelay = 1000L,
isPaused = videoRecorder.isPaused,
recordingTime = videoRecorder.recordingTime,
onDelete = {