Reputation: 2298
it seems that front camera doesn't support focusMode.
func configureDevice() {
if let device = captureDevice {
let focusMode: AVCaptureFocusMode = .AutoFocus
if device.isFocusModeSupported(focusMode) {
device.lockForConfiguration(nil)
device.focusMode = AVCaptureFocusMode.AutoFocus
device.unlockForConfiguration()
println("configured device")
}
}
}
This code doesn't run because
if device.isFocusModeSupported(focusMode)
returns false.
But within the built-in-camera-app, front camera can focus on tap.
Is there any way implement tap-to-focus on the FRONT camera?
Upvotes: 5
Views: 2817
Reputation: 5122
The front-facing camera does not support tap-to-focus on any iPhone. You can use device.focusPointOfInterestSupported
property to check if you can do tap-to-focus (but you will get false, as with isFocusModeSupported()
)
What you are seeing is tap-for-exposure, and you can check for that with device.exposurePointOfInterestSupported
. Once you know that you can use it, use device.exposurePointOfInterest
to set your PoI.
All the details of each mode is explained to detail in Apple Docs
Hope it helps!
Upvotes: 10