star recording back camera that time record with black screen.
Mitesh-Mewada opened this issue ยท comments
When i start video recording back camera start some millisecond recording black color. the contain of cameraView background color is clear. How to solve that ?
Hey @AbyssAlora i change my code as #182 in CameraManager() class but doesn't work if you implemented? so please share code with me. How to solve that ?
Hey, try this and let me know if it isn't working. It's working well for me. I did it in different way of course, but it's easier to send it like this.
open func startRecordingVideo() {
if cameraOutputMode != .stillImage {
let videoOutput = _getMovieOutput()
// setup video mirroring
for connection in videoOutput.connections {
for port in connection.inputPorts {
if port.mediaType == AVMediaType.video {
let videoConnection = connection as AVCaptureConnection
if videoConnection.isVideoMirroringSupported {
videoConnection.isVideoMirrored = (cameraDevice == CameraDevice.front && shouldFlipFrontCameraImage)
}
}
}
}
// let specs = [kCMMetadataFormatDescriptionMetadataSpecificationKey_Identifier as String: AVMetadataIdentifier.quickTimeMetadataLocationISO6709,
// kCMMetadataFormatDescriptionMetadataSpecificationKey_DataType as String: kCMMetadataDataType_QuickTimeMetadataLocation_ISO6709 as String] as [String : Any]
//
// var locationMetadataDesc: CMFormatDescription?
// CMMetadataFormatDescriptionCreateWithMetadataSpecifications(kCFAllocatorDefault, kCMMetadataFormatType_Boxed, [specs] as CFArray, &locationMetadataDesc)
//
// // Create the metadata input and add it to the session.
// guard let captureSession = captureSession, let locationMetadata = locationMetadataDesc else {
// return
// }
//
// let newLocationMetadataInput = AVCaptureMetadataInput(formatDescription: locationMetadata, clock: CMClockGetHostTimeClock())
// captureSession.addInputWithNoConnections(newLocationMetadataInput)
//
// // Connect the location metadata input to the movie file output.
// let inputPort = newLocationMetadataInput.ports[0]
// captureSession.add(AVCaptureConnection(inputPorts: [inputPort], output: videoOutput))
_updateIlluminationMode(flashMode)
videoOutput.startRecording(to: _tempFilePath(), recordingDelegate: self)
} else {
_show(NSLocalizedString("Capture session output still image", comment:""), message: NSLocalizedString("I can only take pictures", comment:""))
}
}
Hey @AbyssAlora thanks for sharing this code and it's absolutely working, Thanks. ๐๐โ๐