Skip to content

Commit

Permalink
Don't mirror rear-facing cameras in the lobby
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Nov 1, 2024
1 parent c9cf7aa commit 7b0bdd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/room/VideoPreview.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ Please see LICENSE in the repository root for full details.
height: 100%;
object-fit: cover;
background-color: black;
transform: scaleX(-1);
background-color: var(--cpd-color-bg-subtle-primary);
}

video.mirror {
transform: scaleX(-1);
}

.avatarContainer {
position: absolute;
top: 0;
Expand Down
8 changes: 7 additions & 1 deletion src/room/VideoPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.

import { useEffect, useRef, FC, ReactNode } from "react";
import useMeasure from "react-use-measure";
import { LocalVideoTrack } from "livekit-client";
import { facingModeFromLocalTrack, LocalVideoTrack } from "livekit-client";
import classNames from "classnames";

import { Avatar } from "../Avatar";
Expand Down Expand Up @@ -56,6 +56,12 @@ export const VideoPreview: FC<Props> = ({
return (
<div className={classNames(styles.preview)} ref={previewRef}>
<video
className={
videoTrack &&
facingModeFromLocalTrack(videoTrack).facingMode === "user"
? styles.mirror
: undefined
}
ref={videoEl}
muted
playsInline
Expand Down

0 comments on commit 7b0bdd3

Please sign in to comment.