CameraManager icon indicating copy to clipboard operation
CameraManager copied to clipboard

StopVideoRecording doesn't trigger completion block in every cases

Open CallMeMeow opened this issue 4 years ago • 2 comments

Hello,

Firstly, thanks for you work!

I'm using CameraManager to create an instagram like experience recording videos or taking pictures. In order to do that, I have one button to record a video and take a picture. Doing that made me realize that if startVideoRecording and stopVideoRecording are called too closely from each other, then the movieOutput is not recording when stopVideoRecording is triggered.

So I looked at that: https://github.com/imaginary-cloud/CameraManager/blob/c4876582c3cfdbb86d49db6a48bf73d550c2b07b/Sources/CameraManager.swift#L781-L787

The completion is not called when this if is not satisfied. I think it would make sense to have an else statement here to call the completion with an error saying that a video couldn't be recorded. Correct me if you think I'm wrong but I think that a completion should be called in any case if it exists. For the time being I found a workaround using the captureSession, hope this helps!

Thank you!

CallMeMeow avatar Apr 22 '20 00:04 CallMeMeow

@CallMeMeow

thanks for your feedback. You are right, the completion should be called to account for those edge cases. I'm currently doing some improvements regarding the video recording, so in the next release I will probably include your suggestion.

torrao avatar Apr 22 '20 07:04 torrao

Hello guyzz, Working perfectly fine with v5.1.3. What I have did just call "cameraManager.cameraOutputMode = .videoWithMic/.videoWithoutMic" before starting video recording.

sonic009 avatar Aug 26 '20 08:08 sonic009