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

Camera Starts at Incorrect Zoom/Lens on Phones with Ultrawide Lenses #548

Open
InspectlyMads opened this issue Jan 30, 2025 · 1 comment

Comments

@InspectlyMads
Copy link

🐛 Bug Report: Camera Initialization Issue with Ultrawide Lens

📌 Affected Versions

  • camerawesome v2.1.0
  • Flutter 3.27.x
  • Tested on Pixel 8 Pro

🔹 Issue Description

🔸 Issue: Android starts in ultrawide mode and resets during video recording

📱 Environment
  • Google Pixel 8 Pro with ultrawide camera lens
🔍 Steps to Reproduce
  1. Open the app using camerawesome v2.1.0 on Flutter 3.27.x
  2. Observe camera initialization behavior:
    • Camera starts at 0.0x zoom (ultrawide lens)
    • In example app, three zoom levels available (0.5x, 1x, 2x)
    • 1x zoom only magnifies ultrawide lens view
    • 0.5x zoom uses ultrawide lens as expected
  3. For video recording:
    • Even after manually switching to wide-angle lens
    • Starting video recording resets configuration back to ultrawide
💻 Code Examples

Initializing the camera (problematic):

SensorConfig config = SensorConfig.single(
  sensor: Sensor.type(SensorType.wideAngle),
  flashMode: FlashMode.auto,
  aspectRatio: CameraAspectRatios.ratio_16_9,
);

Alternative initialization (same issue):

SensorConfig config = SensorConfig.single(
  sensor: Sensor.position(SensorPosition.back),
  flashMode: FlashMode.auto,
  aspectRatio: CameraAspectRatios.ratio_16_9,
);

Partial solution (works for photos but resets during video):

cameraState!.switchCameraSensor(
  type: SensorType.wideAngle,
  flash: FlashMode.auto,
  aspectRatio: currentAspectRatio,
);

Expected Results

  • Camera should always initialize at 1x zoom, ensuring main camera is selected by default
  • In the example app: The 1x zoom button should switch to standard wide-angle lens, not just zoom in on ultrawide lens
  • Video recording should maintain the selected lens configuration

Actual Results

  • On Pixel 8 Pro (with camerawesome v2.1.0 and Flutter 3.27.x):
    • Starts at 0.0x zoom (ultrawide mode) instead of 1x
    • In example app, pressing 1x zoom does not switch to standard wide-angle lens
    • Initializing with SensorConfig.single() always defaults to ultrawide lens
    • Calling switchCameraSensor() works for photos but resets when starting video recording
    • Issue did not occur on older versions (e.g., camerawesome v1.4.0)
@g-apparence
Copy link
Collaborator

g-apparence commented Jan 30, 2025

I am currently updating all dependencies #547
It seems that cameraX version used on the camerawesome pubdev version is not working great

On android we will be still on some version behind as the CameraX authors has deprecated a lot of functions really fast without really explaining how to migrate.

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

No branches or pull requests

2 participants