Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 8bb67c5

Browse files
committed
Invert picture rotation when using front camera
1 parent e494a4f commit 8bb67c5

File tree

1 file changed

+3
-1
lines changed
  • packages/camera/android/src/main/java/io/flutter/plugins/camera

1 file changed

+3
-1
lines changed

packages/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ public void takePicture(String filePath, boolean shouldAutoRotate, @NonNull fina
248248
final CaptureRequest.Builder captureBuilder =
249249
cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
250250
captureBuilder.addTarget(pictureImageReader.getSurface());
251-
int mediaOrientation = shouldAutoRotate ? getMediaOrientation() : 90;
251+
int mediaOrientation = shouldAutoRotate
252+
? getMediaOrientation()
253+
: (isFrontFacing ? -90 : 90);
252254
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, mediaOrientation);
253255

254256
cameraCaptureSession.capture(

0 commit comments

Comments
 (0)