mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Always listen for video finalization event
Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
parent
227e075c0b
commit
41f1aca833
@ -50,7 +50,7 @@ class VideoRecorderService :
|
|||||||
|
|
||||||
// Used to listen and check if the camera is available
|
// Used to listen and check if the camera is available
|
||||||
private var _cameraAvailableListener = CompletableDeferred<Unit>()
|
private var _cameraAvailableListener = CompletableDeferred<Unit>()
|
||||||
private var _videoFinalizerListener = CompletableDeferred<Unit>()
|
private lateinit var _videoFinalizerListener: CompletableDeferred<Unit>;
|
||||||
|
|
||||||
// Absolute last completer that can be awaited to ensure that the camera is closed
|
// Absolute last completer that can be awaited to ensure that the camera is closed
|
||||||
private var _cameraCloserListener = CompletableDeferred<Unit>()
|
private var _cameraCloserListener = CompletableDeferred<Unit>()
|
||||||
@ -129,8 +129,10 @@ class VideoRecorderService :
|
|||||||
stopActiveRecording()
|
stopActiveRecording()
|
||||||
val newRecording = prepareVideoRecording()
|
val newRecording = prepareVideoRecording()
|
||||||
|
|
||||||
|
_videoFinalizerListener = CompletableDeferred()
|
||||||
|
|
||||||
activeRecording = newRecording.start(ContextCompat.getMainExecutor(this)) { event ->
|
activeRecording = newRecording.start(ContextCompat.getMainExecutor(this)) { event ->
|
||||||
if (event is VideoRecordEvent.Finalize && this@VideoRecorderService.state == RecorderState.STOPPED) {
|
if (event is VideoRecordEvent.Finalize && this@VideoRecorderService.state == RecorderState.STOPPED || this@VideoRecorderService.state == RecorderState.PAUSED) {
|
||||||
_videoFinalizerListener.complete(Unit)
|
_videoFinalizerListener.complete(Unit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user