Maui icon indicating copy to clipboard operation
Maui copied to clipboard

fix camera-preview size issue on iOS (#2296)

Open MoienTajik opened this issue 4 months ago • 5 comments

Description of Change

This PR fixes an issue with CameraView where the camera preview showed an image of a different size (smaller/larger based on selected resolution) than the one actually captured.

  • Fixes #2296

PR Checklist

  • [x] Has a linked Issue, and the Issue has been approved (bug) => not approved yet
  • [ ] Has tests (if omitted, state reason in description)
  • [x] Has samples (if omitted, state reason in description)
  • [x] Rebased on top of main at time of PR
  • [x] Changes adhere to coding standard

MoienTajik avatar Aug 23 '25 12:08 MoienTajik

Thank you for this. I think the better fix is to allow developers to provide this value. Either by an options setting or a property on the CameraView, or both.

bijington avatar Aug 23 '25 22:08 bijington

Thanks for the review @bijington! To confirm, I’ll add a cross-platform preview-scaling enum on CameraView (mapped to iOS AVLayerVideoGravity and Android PreviewView.ScaleType), expose it as a bindable property and via options, and set this new behavior as the default since the current default is incorrect. Good to proceed?

MoienTajik avatar Aug 27 '25 09:08 MoienTajik

Sorry I have questions:

  1. If we have a cross platform enum is there an equivalent for Windows too?
  2. The original PR only modified iOS does the Android implementation already set the desired behaviour?
  3. Depending on the answer to the above I'm not sure we should change the default for iOS as that is breaking. Or we at least need to make sure it's what we want and label/advertise it correctly

bijington avatar Aug 27 '25 17:08 bijington

Hello there,

is there any chance that we get this fix?

CoreMyrkai avatar Sep 16 '25 07:09 CoreMyrkai

Sorry I have questions:

  1. If we have a cross platform enum is there an equivalent for Windows too?
  2. The original PR only modified iOS does the Android implementation already set the desired behaviour?
  3. Depending on the answer to the above I'm not sure we should change the default for iOS as that is breaking. Or we at least need to make sure it's what we want and label/advertise it correctly
  1. Currently, no enum exists. We need to introduce one and handle the internal mapping for each platform. I haven’t reviewed the Windows implementation yet.

  2. From my testing, Android behaves correctly by default. It’s working fine, although I noticed in the issue thread that someone reported it for Android as well, but I couldn’t reproduce it.

  3. The current iOS behavior is incorrect and seems to be a bug. However, fixing it would result in a breaking change.

@bijington

MoienTajik avatar Sep 22 '25 09:09 MoienTajik