Last active
August 27, 2017 18:32
-
-
Save TheNorthEestern/806ca3f0aaca975574a5aa4d41b9a4f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func exposeAtPoint(point: CGPoint) { | |
let device = activeInput.device // var activeInput: AVCaptureDeviceInput! | |
if device.isExposurePointOfInterestSupported && device.isExposureModeSupported(.continuousAutoExposure) { | |
do { | |
try device.lockForConfiguration() | |
device.exposurePointOfInterest = point | |
device.exposureMode = .continuousAutoExposure | |
if device.isExposureModeSupported(.locked) { | |
device.addObserver(self, forKeyPath: "adjustingExposure", options: .new, context: &adjustingExposureContext) | |
device.unlockForConfiguration() | |
} | |
} catch { | |
print("Error exposing on POI: \(error.localizedDescription)") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment