-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Calculating camera frame size on viewWillAppear instead
- Loading branch information
Showing
1 changed file
with
4 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,11 @@ final class _LivenessViewController: UIViewController { | |
super.viewDidLoad() | ||
view.backgroundColor = .black | ||
layoutSubviews() | ||
} | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
setupAVLayer() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ruisebas
Author
Member
|
||
super.viewWillAppear(animated) | ||
} | ||
|
||
private func layoutSubviews() { | ||
|
calling
setupAVLayer()
inviewWillAppear
can be problematic here as it will result in the camera being reconfigured multiple times, resulting in AVCaptureSession being destroyed and recreated. This can potentially reintroduce the difficult to reproduce crash in AVCaptureSession[AVCaptureSession startRunning] startRunning may not be called between calls to beginConfiguration and commitConfiguration