Skip to content

[FREQ] Support for Virtual Camera Devices (Multi-Camera Support) #117

@billylo1

Description

@billylo1

Summary

Request support for AVFoundation's virtual camera devices (builtInTripleCamera, builtInDualWideCamera, builtInDualCamera) to enable access to ultra-wide and telephoto lenses, and proper zoom factor support below 1.0x.

Problem Statement

Currently, MijickCamera uses a single builtInWideAngleCamera device, which limits zoom functionality:

  1. No Ultra-Wide Access: Zoom factors below 1.0x are not supported, preventing access to the ultra-wide camera (typically 0.5x zoom)
  2. Limited Lens Switching: Cannot switch between physical camera lenses (ultra-wide, wide, telephoto)
  3. Inconsistent Zoom Behavior: Setting zoom to 0.5x gets clamped to 1.0x (the minimum for wide-angle camera)

Use Case

Modern iPhones (iPhone 11 and later) have multiple camera lenses:

  • Ultra-wide (0.5x zoom factor)
  • Wide (1.0x zoom factor)
  • Telephoto (2x or 3x zoom factor, depending on device)

Users expect to be able to:

  • Switch between these lenses using preset zoom factors
  • Use pinch-to-zoom to smoothly transition between lenses
  • Access the full zoom range from 0.5x to maximum digital zoom

Proposed Solution

Add support for virtual camera devices that automatically switch between physical cameras based on zoom factor:

Option 1: Automatic Virtual Device Selection

Automatically use the best available virtual device:

  • builtInTripleCamera (if available) - supports ultra-wide, wide, and telephoto
  • builtInDualWideCamera (if available) - supports ultra-wide and wide
  • builtInDualCamera (if available) - supports wide and telephoto
  • Fallback to builtInWideAngleCamera (current behavior)

Option 2: Configurable Device Type

Add a new configuration method:

MCamera()
    .setCameraDeviceType(.tripleCamera) // or .dualWide, .dual, .wideAngle
    .startSession()

Option 3: Automatic Based on Zoom Factor

When setZoomFactor() is called with a value < 1.0, automatically switch to a virtual device that supports it.

Technical Details

AVFoundation Virtual Devices

Virtual devices provide seamless switching between physical cameras:

// Example: Triple Camera System
let tripleCamera = AVCaptureDevice.default(
    .builtInTripleCamera,
    for: .video,
    position: .back
)

// Zoom factors automatically switch cameras:
// 0.5x → Ultra-wide camera
// 1.0x → Wide camera  
// 3.0x → Telephoto camera

let minZoom = tripleCamera.minAvailableVideoZoomFactor // Could be 0.5
let maxZoom = tripleCamera.maxAvailableVideoZoomFactor // Could be 15.0+
let switchOverFactors = tripleCamera.virtualDeviceSwitchOverVideoZoomFactors

Current Limitation

With single builtInWideAngleCamera:

  • minAvailableVideoZoomFactor = 1.0 (cannot go below)
  • Setting zoom to 0.5x gets clamped to 1.0x
  • No access to ultra-wide or telephoto physical lenses

Benefits

  1. Full Camera System Access: Utilize all available camera hardware
  2. Better User Experience: Match native iOS Camera app behavior
  3. Proper Zoom Support: Support zoom factors from 0.5x to maximum
  4. Seamless Lens Switching: Automatic camera switching based on zoom factor
  5. Future-Proof: Support for new multi-camera configurations

Implementation Considerations

  1. Backward Compatibility: Maintain current behavior for devices without multi-camera support
  2. Session Management: Virtual devices may require different session configuration
  3. Performance: Ensure smooth transitions between cameras
  4. Error Handling: Gracefully handle cases where virtual device is unavailable

Related Issues

Additional Context

This feature would enable apps built with MijickCamera to:

  • Provide lens switching UI (0.5x, 1x, 2x, 3x buttons)
  • Support pinch-to-zoom across the full range
  • Match the functionality of native iOS camera apps
  • Better utilize modern iPhone camera hardware

References


Submitted by: GreenCheckmark App Team
Date: 2026-01-25
MijickCamera Version: 3.0.3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions