Skip to content

Issue: CameraPreview.capture() ignores requested dimensions, defaulting to initialization resolution #374

@bokzor

Description

@bokzor

CameraPreview.capture() ignores requested dimensions, defaulting to initialization resolution

Description

The CameraPreview.capture() method ignores the explicitly requested dimensions (2048x2048) and instead captures images at the resolution specified during initialization (1024x1024). This prevents capturing higher resolution photos than what was initially set up.

Expected Behavior

When calling CameraPreview.capture() with specified dimensions of 2048x2048, the plugin should capture images at this higher resolution, regardless of the initialization settings.

Actual Behavior

The plugin captures images at the resolution specified during initialization (1024x1024) and completely ignores the parameters passed to the capture() method. This makes it impossible to dynamically request higher-quality captures at runtime.

Reproduction Steps

  1. Initialize CameraPreview with width: 1024, height: 1024
  2. Call capture() with width: 2048, height: 2048, quality: 90
  3. Check the dimensions of the returned image
  4. Note that the dimensions are 1024x1024, matching the initialization parameters rather than the capture parameters

Technical Details

The plugin appears to establish the capture resolution at initialization time and does not allow it to be changed during runtime through the capture() method parameters. This severely limits the flexibility of the plugin for applications that need to adjust capture quality dynamically.

Possible Solutions

  1. Modify the plugin to respect the dimensions passed to the capture() method, overriding the initialization settings
  2. Add a separate method to update capture resolution at runtime before capturing
  3. Document this limitation clearly if it's an intentional design decision

Environment

  • Capacitor CameraPreview plugin version: [7.0.0]
  • iOS version: [17]
  • Device tested: iPhone [14]
  • Safar (PWA)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions