-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix focus and camera handling for newer iOS devices with triple cameras (+ other fixes) #342
Conversation
The CameraController now prioritizes `builtInTripleCamera` and similar options to select the best fitting camera. This enhances continuous auto-focus on newer iPhones, especially Pro models. Closes: capacitor-community#324 Addresses: capacitor-community#256
@@ -0,0 +1,56 @@ | |||
extension UIImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just moved to a separate file. Was previously located in CameraController.swift
It seems that the captureSample method does not work (when I call it, I never get the response or error). |
@florianleger hm, yes probably [due to the removal of the AVCaptureVideoDataOutput which I did because of severe performance problems with handling multiple outputs. In theory we might make this an optional feature which can be enabled via some flag and then configures a DataOutput again 🤔 |
Since I did quite a lot of opinionated changes to the code I decided to publish a lite version of the plugin on my own until further development goes on with the official version :). Feel free to use my version as long as you just want to take photos and do not require video recordings etc: https://github.com/michaelwolz/camera-preview-lite |
@michaelwolz THANK YOU!!!! |
Overview
This PR fixes several open issues, particularly on iOS, by addressing problems related to newer iOS devices with triple cameras (iPhone 14 Pro and later). Also this PR cleans up the iOS code, removes dead code and updates deprecated function calls that triggered warnings.
We are currently using this adapted version of the plugin in our app and it works perfectly fine for us. I don't know if this plugin is still actively maintained or not but I appreciate any feedback and am also willing to do adaptions if this is necessary to get it merged into the official codebase.
Changes
photo
startRecordVideo()
orstopRecordVideo()
on iOS and adapted the readme accordingly. This was not implemented even though documentation says it is. I think it's better to fully remove this from the code and refer to another solution such as: https://github.com/capacitor-community/video-recorder. I'd wish I would have a better solution but since I am not using this feature I decided to just change the current behvior to not confuse devs that call these methods and expect any output from it (also unnecessarily adding theDataOutput
for the video capture was slowing down starting the camera by a lot).x
andy
coordinatescheckPermissions
andrequestPermissions
method for iOSResolved Issues
Note: I just saw that #339 also updates to the new Camera v2 API which would be even better due to many deprecation warnings with the old code but still this PR will fix the rotation logic with the old API