user3294816
user3294816

Reputation: 47

Rotate or flip preview in Android Camera2 API

I am trying to rotate and/or flip the preview being displayed using the Camera2 API.

I tried setting the JPEG_ORIENTATION on the previewRequestbuilder to rotate the preview but that did not have any effect.

What other methods are available to rotate the preview?

In Camera1, this was achieved via setdisplayorientation.

Upvotes: 2

Views: 2270

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18107

There is no direct control for this - for SurfaceViews and TextureViews, the correct rotation is baked in by the API. For a pure SurfaceTexture, the getTransform() call includes the correct rotation.

If you want your own custom flip or rotation, you'll need to do your own GL rendering with a SurfaceTexture and a GLSurfaceView or equivalent.

Upvotes: 1

Related Questions