packages icon indicating copy to clipboard operation
packages copied to clipboard

[camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support

Open camsim99 opened this issue 1 year ago • 0 comments

Partially lands https://github.com/flutter/packages/pull/6856. This PR specifically includes:

1: A fix for correctly rotating the camera preview

This fix is required for Surfaces not backed by a SurfaceTexture because they don't contain the transformation information needed to correctly rotate the camera preview. In that case, we use the logic described in https://developer.android.com/media/camera/camera2/camera-preview#orientation_calculation.

The fix is not currently used (the logic is not reachable) as Impeller support has not been added back to the plugin, but has been tested in https://github.com/flutter/packages/pull/6856 and will be turned on when https://github.com/flutter/flutter/issues/149294 is fixed.

Part of https://github.com/flutter/flutter/issues/149294.

2: A fix for correctly rotating the camera preview on naturally landscape-oriented devices

I believe this issue was caused because we assume that the natural orientation of the device is portrait up. We fix this here by adding an extra rotation for the camera preview based on the natural orientation of the device.

Fixes https://github.com/flutter/flutter/issues/149177.

Pre-launch Checklist

camsim99 avatar Jul 02 '24 17:07 camsim99