imaginary-cloud / CameraManager

Simple Swift class to provide all the configurations you need to create custom camera view in your app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cameraManager.stopVideoRecording doesn't triggering callback

hiteshcmarix opened this issue · comments

Sometimes, cameraManager.stopVideoRecording seems work perfection in lower duration recording, but when try to do more recording then it will not return completion block, it was not going in below condition because runningMovieOutput.isRecording returning false (in CameraManager.swift) and didn't get callback :

if let runningMovieOutput = movieOutput,
         runningMovieOutput.isRecording {
         videoCompletion = completion
        runningMovieOutput.stopRecording()
} 

I also tried different ways from given feedback like
1.) Moving cameraManager.cameraOutputMode in the "record" button method just before calling
cameraManager.startRecordingVideo()
but, this is not working.

2.) By checking and changing cameraOutputMode before start recording and after stop recording
Before start recording :
```
if cameraManager.cameraOutputMode == .stillImage {
print("Camera output is stillImage, switching to videoWithMic")
cameraManager.cameraOutputMode = .videoWithMic
}
cameraManager.startRecordingVideo()


      _After stop recording :_

        ```
cameraManager.stopVideoRecording { (URL, error) in
             print("Video Recording URL: ", URL!);
    
             if cameraManager.cameraOutputMode == .videoWithMic {
                     cameraManager.cameraOutputMode = .stillImage
             }
        }

I tried above solutions but none of these are working for me. 🙁
I am using CameraManager cocoapod (version 5.1.3)

Could you please help me out of this issue?
Waiting for your response...😌

Please follow the instructions:

cameraManager.addLayerPreviewToView(cameraView, newCameraOutputMode: .videoOnly) {
self.cameraManager.startRecordingVideo()
}

I have a question. I tried to stop recording, but it doesn't seem to have worked. Can you help me with this?