Skip to content

Instantly share code, notes, and snippets.

@TheNorthEestern
Last active August 27, 2017 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheNorthEestern/806ca3f0aaca975574a5aa4d41b9a4f5 to your computer and use it in GitHub Desktop.
Save TheNorthEestern/806ca3f0aaca975574a5aa4d41b9a4f5 to your computer and use it in GitHub Desktop.
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