When using LiveKit Android SDK, I noticed inconsis...
# ask-ai
s
When using LiveKit Android SDK, I noticed inconsistent mirroring behavior between the front and back camera. Expected behavior Calling: videoView.setMirror(false) should disable mirroring for both front and back cameras. Actual behavior Front camera: still mirrored Back camera: not mirrored If I call: videoView.setMirror(true) Front camera: looks correct Back camera: becomes mirrored So the mirror flag seems to be applied on top of an already mirrored front camera frame.
t
Thanks for reaching out, ABDULLAH. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — that’s a great report and I can see why the behavior is confusing. What you’re seeing matches how the Android renderers work: LiveKit’s Android renderers apply automatic mirroring for front-facing cameras. The
setMirror()
call applies an additional mirror transform on top of that automatic mirroring, which results in the inconsistent behavior you described: •
setMirror(false)
— front camera remains mirrored (because automatic front-camera mirroring is still applied), back camera not mirrored. •
setMirror(true)
— front camera looks correct (automatic mirror + manual mirror = no net mirror), back camera becomes mirrored. What I can help with next 1. Quick checks I recommend now: ◦ Which LiveKit Android SDK version are you using? ◦ Which renderer are you using:
SurfaceViewRenderer
or
VideoTextureViewRenderer
? ◦ Can you share the minimal code that attaches the renderer and calls
setMirror()
(or describe whether
setMirror()
is called before/after attaching the track)? 1. Immediate workarounds you can try: ◦ Toggle the mirror setting after the renderer is fully attached to the track/view (call
setMirror(...)
after initialization and after you add the renderer to the track). ◦ If you need the front camera to be non-mirrored always, try disabling the renderer’s automatic front-camera mirroring (some renderer options expose this; let me know which renderer and SDK version and I’ll point to the exact flag). If a direct option isn’t available in your SDK version, you can apply a manual transform on the view to force the desired orientation instead of relying on
setMirror()
alone. 1. If you want, I can: ◦ Provide exact code snippets for applying the mirror toggle at the correct time for your renderer and SDK version. ◦ Check whether a newer SDK version changes this behavior and point to the release notes. Which renderer and SDK version are you on, and can you paste the small snippet where you create the renderer, attach it to the track, and call
setMirror()
? Once I have that I’ll give a concrete change to fix the behavior. Sources: client-sdk-android | livekit/livekit_composite | DeepWiki