-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
App is zoomed in after zooming in while taking picture (AR Kit) iOS only. #82
Comments
That is indeed a very interesting issue. I don't create the camera user interface manually (i.e. zoom button, switch camera button, capture button), they are all parts of the native camera user interface (a preset). This native preset returns me only a single value: the captured photo's path. It doesn't return the zoom level or AFAIK allow me to change the zoom level programmatically. So, at the moment, this issue will probably remain open. |
let me know if you need more details in the future, we will certainly keep trying to find a solution |
Can you try adding the following code to here and cross your fingers: NOTE: I didn't compile this code myself, there might be compiler errors. PPS. You can add this code in the Xcode project (while testing), no need to rebuild the Unity project. |
So I do not have Xcode with me, but I changed the .mm file by adding your line of code on line 276, and tried with Unity Cloud builds and I have this: Error from Cloud Build: /BUILD_PATH/xxxxxxx/temp20220127-4912-acmz1m/Libraries/Plugins/NativeCamera/iOS/NativeCamera.mm:277:171: assigning to 'readonly' return result of an Objective-C message not allowed I believe it is on: videoZoomFactor = 1.0, could it be that we cannot set it? I wonder also if there is some other zoomFactor property since this one is for video but the problem is for taking pictures 🤔 |
How about this:
PS. There is no equivalent of AVMediaTypeVideo for photos, so I'm hoping that it points to the camera that takes the photos. |
I could create the build and test, however it was not successful. The problem persists |
My final attempt: AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltInWideAngleCamera mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionBack];
if (device != nil)
{
NSError *error = nil;
if ([device lockForConfiguration:&error])
{
device.videoZoomFactor = 1.0;
[device unlockForConfiguration];
}
else
{
NSLog(@"Reset zoom error: %@", error);
}
} As an unrelated note, if you can take pictures by capturing a screenshot of the AR camera instead (same solution I've proposed in #84), then you won't have zoom issues, as well. |
Same result, it is still a problem. Yes, the screenshot would solve the issue. |
Description of the bug
Only happening on iOS!
We are currently using this asset to take pictures and we are also using AR Core/Kit. If we are taking a picture and we zoom in, then after exiting the native camera, the zoom is still there and we cannot reset it because AR Core/Kit takes control of the camera stream.
Reproduction steps
Start the plugin to take a picture.
Zoom in,
Take picture or close the native camera,
The camera is zommed in the entire app.
Additional info
On Android the camera's zoom is reset automatically, which could probably mean that it could be also done for iOS.
The text was updated successfully, but these errors were encountered: