Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Fix focus and exposure state after focusing at point #32

Merged
merged 1 commit into from
Jun 4, 2016

Conversation

michalciurus
Copy link
Contributor

The focus:atPoint method should not override the current focus/exposure method.

For example it results in ContinuousAutoFocus being changed to AutoFocus. AutoFocus changes to Locked automatically after it focuses, so after using the focus atPoint method the focus and exposure is locked resulting in poor image.

if currentDevice.focusMode == AVCaptureFocusMode.Locked {
currentDevice.focusMode = AVCaptureFocusMode.AutoFocus
} else {
currentDevice.focusMode = AVCaptureFocusMode.ContinuousAutoFocus
Copy link
Contributor Author

@michalciurus michalciurus Jun 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One strange thing I noticed in AVFoundation is that you have to explicitly call currentDevice.focusMode = AVCaptureFocusMode.ContinuousAutoFocus even if is already in .ContinuousAutoFocus. Otherwise the focus action simply won't work.

Any explanation for that ? 😶

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea. I didn't play enough with the API yet, to notice something. 🙃

@remirobert
Copy link
Owner

Thank you so much for your PR.

@remirobert remirobert merged commit 9ad7204 into remirobert:master Jun 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants