Flip previewView horizontally

34 views
Skip to first unread message

Vishwajeet Singh

unread,
Apr 8, 2023, 12:13:46 PM4/8/23
to Android CameraX Discussion Group
Hi, 
I want to horizontally flip the preview stream, I tried setRotation = -1F it succesfully worked in my older device running on api 22 but in newer devices (mine api 33) its not working. How can I do that . Thanks

Scott Nien

unread,
Apr 9, 2023, 11:05:14 PM4/9/23
to Vishwajeet Singh, Android CameraX Discussion Group
Try setting it to COMPATIBLE mode which will use TextureView under the hood. Only TextureView can rotate / flip the preview.  SurfaceView can't do that. 
        mPreviewView.setImplementationMode(PreviewView.ImplementationMode.COMPATIBLE);

BTW, I guess you want to invoke setScaleX(-1f) to flip the preview.    

On Sun, Apr 9, 2023 at 12:13 AM Vishwajeet Singh <infovis...@gmail.com> wrote:
Hi, 
I want to horizontally flip the preview stream, I tried setRotation = -1F it succesfully worked in my older device running on api 22 but in newer devices (mine api 33) its not working. How can I do that . Thanks

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/99febf1e-3c42-4290-b688-f098a98a68ben%40android.com.
Reply all
Reply to author
Forward
0 new messages