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

Android - Orientation of B64 image upside down with Front Facing Camera

Open mattmilan-dev opened this issue 4 years ago • 1 comments

Describe the bug When taking a photograph on the Samsung Galaxy A40 using the front facing camera on device, the finalised base64 image appears upside down, even after the supposed fix of #75. On NPM Version 2.0.0-beta0

To Reproduce Load the camera preview and run await CameraPreview.capture(); displaying the image in an img tag.

Expected behavior The expected behaviour is that regardless of camera, the orientation should always be the right way up.

Screenshots Screenshot_20210314-190518 Screenshot_20210314-190539

Smartphone (please complete the following information):

  • Device: Samsung Galaxy A40
  • OS: Android 10

Additional context Oddly, the device has 3 cameras available: Back, Front (Really Zoomed In, but front camera) and Front (less zoomed in, [i'm guessing Ultrawide]). To get to the front facing camera i have to call the flip function twice, which led me to believe that the cameraCurrentlyLocked == Camera.CameraInfo.CAMERA_FACING_FRONT part of the if statement on L658 was blocking reaching the switch statement. Once i removed that part of the if statement it worked as expected, however this caused the back camera to (as you probably guessed), flip upside down.

I edited CameraActivity.java#658 to if(cameraCurrentlyLocked != Camera.CameraInfo.CAMERA_FACING_BACK && disableExifHeaderStripping) { and now everything seems to be working, although i don't know if this would work with cameras having multiple back facing cameras, therefore will not submit a pull request until more information has come in.

I do not know Java so i don't know what is at fault here.

mattmilan-dev avatar Mar 14 '21 19:03 mattmilan-dev

Im getting the same error on Samsung s10e would you try this if the platform is android

  <img [ngClass]="!platform.is('ios') && cameraPreviewOptions.position != 'rear' ? 'fix-flip':''" [src]="photo">
    .fix-flip{
         transform: scaleY(-1);
     }

facusatoshi avatar Aug 17 '21 15:08 facusatoshi