How to Fix capturing images with front facing camera mirrors image? SnapChat seems to fix it as well as WhatsApp and Instagram , how can i? i would really love to find a sol
i figured this out myself, Here is the solution:
if captureDevice.position == AVCaptureDevicePosition.back {
if let image = context.createCGImage(ciImage, from: imageRect) {
return UIImage(cgImage: image, scale: UIScreen.main.scale, orientation: .right)
}
}
if captureDevice.position == AVCaptureDevicePosition.front {
if let image = context.createCGImage(ciImage, from: imageRect) {
return UIImage(cgImage: image, scale: UIScreen.main.scale, orientation: .leftMirrored)
}
}
}
return nil
}