Add minimum zoom scale support and custom video output URL#281
Open
shabbirv wants to merge 5 commits intoimaginary-cloud:masterfrom
Open
Add minimum zoom scale support and custom video output URL#281shabbirv wants to merge 5 commits intoimaginary-cloud:masterfrom
shabbirv wants to merge 5 commits intoimaginary-cloud:masterfrom
Conversation
Changed minimum zoom level from 1.0x to 0.5x to support newer cameras with ultra-wide lenses. Updated documentation to reflect the new zoom range (0.5x to device maximum). https://claude.ai/code/session_01KpFgCpFkFy6d6S2V73DQqm
Changed zoom implementation to dynamically detect minimum zoom level using minAvailableVideoZoomFactor from the camera device. This ensures ultra-wide cameras are properly supported only on devices that have them. - Added minZoomScale property to track device minimum zoom - Updated _setupMaxZoomScale() to set both min and max zoom limits - Changed _zoom() to use dynamic minZoomScale instead of hardcoded 0.5 - Updated README to clarify that zoom range is device-dependent On multi-camera devices (iPhone 11+), the minimum zoom factor is 1.0, which automatically uses the ultra-wide lens. This is the correct iOS behavior rather than using an arbitrary 0.5x value. https://claude.ai/code/session_01KpFgCpFkFy6d6S2V73DQqm
The previous implementation only selected the first back camera device, which would return the basic wide-angle camera without ultra-wide support. Changed camera discovery to use AVCaptureDevice.DiscoverySession with priority order: 1. .builtInTripleCamera (iPhone 11 Pro+, supports ultra-wide) 2. .builtInDualWideCamera (iPhone 11/13/14, supports ultra-wide) 3. .builtInDualCamera (older dual camera models) 4. .builtInWideAngleCamera (fallback for single camera devices) This ensures that on devices with ultra-wide cameras (iPhone 11+), the multi-camera virtual device is selected, which allows iOS to automatically switch to the ultra-wide lens when zoom is set to 1.0. Updated README to explain which device types are now supported and how ultra-wide camera switching works. https://claude.ai/code/session_01KpFgCpFkFy6d6S2V73DQqm
On multi-camera devices with ultra-wide cameras, the default zoom now starts at the first switchover point (e.g., 2.0) which represents the main wide-angle camera at "1x" zoom - matching the default Camera app behavior. Changes: - Detect virtualDeviceSwitchOverVideoZoomFactors on iOS 13+ - Set initial zoom to first switchover point for multi-camera devices - Change _zoom(0) to _zoom(1) to maintain the default zoom level - Fallback to minimum zoom for single-camera devices This fixes the issue where the camera would start at the ultra-wide lens (0.5x zoom) instead of the expected wide-angle lens (1x zoom). https://claude.ai/code/session_01KpFgCpFkFy6d6S2V73DQqm
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced the camera manager's zoom functionality to support minimum zoom levels and added the ability to specify a custom output URL when recording videos.
Key Changes
minZoomScaleproperty that automatically detects and uses the device's minimum available video zoom factor (e.g., ultra-wide camera on iPhone 11+)startRecordingVideo()to accept an optionalurlparameter, allowing callers to specify a custom output path instead of always using the temporary directory_setupMaxZoomScale()to query bothmaxAvailableVideoZoomFactorandminAvailableVideoZoomFactorfrom the active camera devicemax(minZoomScale, min(...))instead of hardcodedmax(1.0, ...)Implementation Details
startRecordingVideo()is optional and defaults to the existing temporary file path behavior for backward compatibilityhttps://claude.ai/code/session_01KpFgCpFkFy6d6S2V73DQqm