Skip to content

Commit

Permalink
Fixed focus mode in AVFLiveVideo
Browse files Browse the repository at this point in the history
Summary: The focus mode needs to be `AVCaptureFocusModeLocked` in case the user specifies a custom focus (`AVCaptureFocusModeContinuousAutoFocus` re-set the focus back to an auto focus immediately).

Reviewed By: enpe

Differential Revision: D67607868

fbshipit-source-id: 4ab3e7b9a61ec29eeb415b1f3b26d7da2b03775f
  • Loading branch information
janherling authored and facebook-github-bot committed Jan 6, 2025
1 parent d353a64 commit 796315c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion impl/ocean/media/avfoundation/AVFLiveVideo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,13 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
if ([captureDevice_ isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus])
{
[captureDevice_ setFocusMode:AVCaptureFocusModeContinuousAutoFocus];

result = true;
}
else if ([captureDevice_ isFocusModeSupported:AVCaptureFocusModeAutoFocus])
{
[captureDevice_ setFocusMode:AVCaptureFocusModeAutoFocus];

result = true;
}
else
Expand All @@ -401,8 +403,9 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
{
if (captureDevice_.isLockingFocusWithCustomLensPositionSupported)
{
[captureDevice_ setFocusMode:AVCaptureFocusModeLocked];
[captureDevice_ setFocusModeLockedWithLensPosition:position completionHandler:nil];
[captureDevice_ setFocusMode:AVCaptureFocusModeContinuousAutoFocus];

result = true;
}
}
Expand Down

0 comments on commit 796315c

Please sign in to comment.