Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera preview is getting rotated

For some reason (only on some of the phones) my camera preview is rotated 90 degrees.

Device orientation utils on debug says the same thing for working and not working phones: D/CameraOrientationUtil(14552): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90

Using camera: ^0.11.0+1

This is how I build a preview: Expanded(child: _cameraController!.buildPreview()),

Which results in:

enter image description here

when I take a pic tho, the rotation is fine:

enter image description here

I can rotate the view, but then "working" phones are rotated... If anybody has any ideas I'd really appreciate it.

like image 719
Michal Avatar asked Dec 13 '25 15:12

Michal


2 Answers

With the "camera" package 0.11.0+, the "camera_android_camerax" package is the default package for Android, and it causes the orientation problem.

You don't need to downgrade the camera package. Just add the "camera_android" package for it. ;)

$ flutter pub add camera_android

Note)

if camera_android_camerax fixed, please add a comment to this answer. I will update the answer. For now, camera_android_camerax==0.6.13 dose not work.

like image 143
Jaepil Koh Avatar answered Dec 15 '25 19:12

Jaepil Koh


I had the same issue: just downgrade camera to version ^0.10.6

like image 21
zMarcello Avatar answered Dec 15 '25 19:12

zMarcello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!