Skip to content
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

Use photo preset to remove excess zoom on ios 17+ #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TreehouseNorris
Copy link

@TreehouseNorris TreehouseNorris commented Feb 14, 2025

Summary:

Fixes issue where iOS 17 & 18, CameraPreview.start {
position: rear,
disableAudio: true,
enableHighResolution: false
}, with no use of any CameraPreview.setZoom, was showing a more zoomed in feed than the native Camera app did.

Task Links:

PR #339
Issue #180

Test Instructions:

Place iOS device on a stack of books overlooking a computer keyboard, to keep an identical device position.
Use the native Camera app to take a photo of the keyboard.
Create code that shows the prior photo with partial transparency over the fullscreen CameraPreview.start feed.
Verify that the preview feed matches the scale of the key outlines and lettering in the reference photo.

Developer Notes:

I tested my solution on an iPhone 12 Pro iOS18.3 (which has multiple rear cameras, devicePixelRatio of 3) and an iPad (no notch, only has one rear camera, devicePixelRatio 2) iOS 17, and the fix showed correctly on both.
Update: Verified this works on iPhone 11 iOS18 (the zoom amount was correct, for the placement: instead of modifying AVLayerVideoGravity.resizeAspectFill, it needed the below for its devicePixelRatio of 2)

CameraPreview.start({
x: myPointX * (isPlatformIos() ? window.devicePixelRatio/2 : 1),
y: myPointY * (isPlatformIos() ? window.devicePixelRatio/2 : 1),
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant