The console will not log. If you change the timeout to 1000 it will work.
Also, if you replace with pausePreview() it will still not stop the video (just pause the preview).
The problem here is that there is no way for me to tell if the recording can actually be canceled. recordAsync does not guarantee that stopRecording() will actually function.
You can’t do that because recordAsync blocks the thread until stopRecording gets called.
There is no way to programmatically know when the recordAsync can be killed…so now you have to create a retry function that runs every X ms to check…
The way it should work…recordAsync should return as soon as the camera actually starts and then you should be able to cancel it after that. That way you could set a ref.current flag to say it’s cancellable…
Then when you stopRecording…that should return the actual data…
i seem to recall something like cameraRef.current.isRecording used to be a thing, but only on iOS
maybe recordAsync could mark that a recording has been initialized before returning the promise but before the first frame is recorded,
and stopRecording could fire any time after the promise is returned and abort the upcoming recording
but what would it return? a uri pointing to a video of 0ms duration?