I want to capture mirrored video from livekit
# ask-ai
f
I want to capture mirrored video from livekit
t
Thanks for reaching out, Ayush. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to understand a bit more about what you're aiming to do with capturing mirrored video. Could you share a bit more? • Are you hoping to record the mirrored video, like saving it to a file? • Or do you want to capture frames from the mirrored output for some processing? • Maybe you're trying to make sure the remote participant sees the mirrored version? Knowing this will really help me guide you in the best way possible. Sources: Documentation/BasicUsage.md | src/components/VideoTrack.tsx | lib/src/widgets/video_track_renderer.dart | Sources/LiveKit/Protocols/Mirrorable.swift | livekit-android-sdk/src/main/java/io/livekit/android/renderer/TextureViewRe...
r
@alert-easter-19258 I'm just wondering where use the mirrored video in reactjs (not react-native), all i see is a TrackSelector
t
It sounds like you’re using React (web) and seeing
TrackSelector
. To mirror the self-view in React, apply a CSS flip to the rendered video element (no special LiveKit API needed). • If you render a
VideoTrack
(from
@livekit/components-react
): ◦ Add a style when the track is local:
style={{ transform: 'scaleX(-1)' }}
Example:
Copy code
<VideoTrack trackRef={trackRef} style={{ transform: isLocal ? 'scaleX(-1)' : undefined }} />
• If you attach to a plain `<video>`:
Copy code
<video ref={ref} style={{ transform: 'scaleX(-1)' }} />
This mirrors only the view; it doesn’t change the actual stream. For context, the web demo uses the same approach with CSS transforms scale(-1, 1). If you share how you’re rendering tracks (using
@livekit/components-react
, manual attach, or a custom
TrackSelector
flow), I can tailor the snippet. Sources: Web Applications &amp; Integration Examples | livekit/livekit_composite | DeepW... | Expo quickstart | LiveKit docs | Subscribing to tracks | LiveKit docs | React quickstart | LiveKit docs
r
yes this works