camera-preview icon indicating copy to clipboard operation
camera-preview copied to clipboard

iOS, a picture taken in the landscape orientation is captured as a portrait photo.

Open orest opened this issue 3 years ago • 7 comments

Describe the bug I might be doing something wrong, but pictures taken using iPhone X in the landscape orientation are captured as portrait photos. Android works correctly. I can not figure out how to take landscape picture in iOS. i tried to play with rotateWhenOrientationChanged without any luck.

To Reproduce Steps to reproduce the behavior:

  1. Start Preview
 const cameraPreviewOptions: CameraPreviewOptions = {
            position: 'rear',
            parent: 'cameraPreview',
            className: 'cameraPreview',
            rotateWhenOrientationChanged: true,
            toBack: true,
            storeToFile: true,
        };

        await CameraPreview.start(cameraPreviewOptions);
  1. Rotate the phone into the landscape
  2. Capture the photo
const cameraPreviewPictureOptions: CameraPreviewPictureOptions = {
            quality: 90,
        };

        const result = await CameraPreview.capture(cameraPreviewPictureOptions);
  1. Captured image will be a portrait image with the picture rotated 90 degrees. Essentially its impossible to capture landscape image in iOS

Expected behavior Captured image should be landscape

Smartphone (please complete the following information):

  • Device: iPhone X Max
  • OS: 15.5
  • Browser stock browser, safari

Additional context

  • Capacitor 3.4.0
  • @capacitor-community/camera-preview - 3.1.0

orest avatar Jul 10 '22 05:07 orest

Same problem

danglemonster avatar Jul 19 '22 04:07 danglemonster

Confirming the problem. This PR should fix this problem https://github.com/capacitor-community/camera-preview/pull/235

Can someone install the fix from here and test? npm install ryaa/camera-preview#bufgix/232-ios-picture-taken-in-landscape-orientation-is-captured-as-portrait-photo

ryaa avatar Jul 19 '22 05:07 ryaa

Thank you so much! It looks like it's working. I will give it a better test over the weekend. Greatly appreciated!

orest avatar Jul 20 '22 04:07 orest

@orest Were you able to test this? I'd like to merge it into the next release if it's working.

pbowyer avatar Jul 25 '22 07:07 pbowyer

Yes, I was able to perform additional testing on iOS and did a quick regression on Android, and everything is working as expected. Thank you, guys! Awesome job!

orest avatar Jul 25 '22 23:07 orest

@pbowyer I think it's ready to be merged. Thank you!

orest avatar Jul 25 '22 23:07 orest

@pbowyer if you have time to merge :)

riderx avatar Aug 03 '22 14:08 riderx