video preview is showing black screen - iOS

205 views Asked by At

My app is working to capture video from camera but on iPhone 11 devices video preview initial screen is showing black. Video plays in preview well only first snapshot of preview is black. Following is my code:-

if (UIImagePickerController.isSourceTypeAvailable(.camera)) {
        if UIImagePickerController.availableCaptureModes(for: .rear) != nil {
            if type == .video {
                self.cameraPicker.sourceType = .camera
                self.cameraPicker.allowsEditing = false
                self.cameraPicker.delegate = self
                self.cameraPicker.mediaTypes =  [kUTTypeMovie as String]
                self.cameraPicker.cameraCaptureMode = (type == .video) ? .video : .photo
                present(self.cameraPicker, animated: true, completion: {})
            } 
}
}

Thanks in advance.

0

There are 0 answers