Open aaasifrz9 opened 6 years ago
Actually, we are not able to access inputCamera:AVCaptureDevice of class Camera because this variable is not public. Please do the needful. Either make it public or provide any method to enable torch. Thanks in advance.
extension AVCaptureDevice {
func setTorchMode(mode: AVCaptureTorchMode) {
do {
try self.lockForConfiguration()
if(self.hasTorch && self.isTorchModeSupported(mode)) {
self.torchMode = mode
}
self.unlockForConfiguration()
} catch {
print("Could not set flash mode: \(error)")
}
}
}
Then make sure the inputCamera var is public on the Camera class and you can do the following:
self.camera!.inputCamera.setTorchMode(mode: .auto)
Thanks @joshbernfeld
Hi @BradLarson,
I tried to identify AVCaptureTorchMode for integration of Flash/Torch but not able to get anything. 1- How can I integrate it? 2- How can I change mode ON/OFF?
Please help. Thanks in advance.