mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
feat: Add some optional delay to RecordingControl
This commit is contained in:
parent
76752e9004
commit
e719c0f8fb
@ -30,6 +30,7 @@ import kotlinx.coroutines.launch
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RecordingControl(
|
fun RecordingControl(
|
||||||
|
initialDelay: Long = 0L,
|
||||||
isPaused: Boolean,
|
isPaused: Boolean,
|
||||||
recordingTime: Long,
|
recordingTime: Long,
|
||||||
onDelete: () -> Unit,
|
onDelete: () -> Unit,
|
||||||
@ -67,6 +68,8 @@ fun RecordingControl(
|
|||||||
|
|
||||||
LaunchedEffect(animateIn) {
|
LaunchedEffect(animateIn) {
|
||||||
if (animateIn) {
|
if (animateIn) {
|
||||||
|
delay(initialDelay)
|
||||||
|
|
||||||
val stack = RandomStack.of(arrayOf(1, 2, 3).asIterable())
|
val stack = RandomStack.of(arrayOf(1, 2, 3).asIterable())
|
||||||
|
|
||||||
while (!stack.isEmpty()) {
|
while (!stack.isEmpty()) {
|
||||||
|
@ -142,6 +142,10 @@ fun VideoRecordingStatus(
|
|||||||
|
|
||||||
if (!videoRecorder.isStartingRecording) {
|
if (!videoRecorder.isStartingRecording) {
|
||||||
RecordingControl(
|
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,
|
isPaused = videoRecorder.isPaused,
|
||||||
recordingTime = videoRecorder.recordingTime,
|
recordingTime = videoRecorder.recordingTime,
|
||||||
onDelete = {
|
onDelete = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user