Skip to content

Commit 962ebec

Browse files
author
timmydoza
authored
Update CSS for mirroring local video (#691)
This helps to workaround a Safari CSS issue related to transforms
1 parent 5060ac2 commit 962ebec

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/VideoTrack/VideoTrack.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('the VideoTrack component', () => {
6161

6262
it('should flip the video horizontally if the track is local', () => {
6363
const { container } = render(<VideoTrack track={mockTrack} isLocal />);
64-
expect(container.querySelector('video')!.style.transform).toEqual('rotateY(180deg)');
64+
expect(container.querySelector('video')!.style.transform).toEqual('scaleX(-1)');
6565
});
6666

6767
it('should not flip the video horizontally if the track is the local rear-facing camera', () => {

src/components/VideoTrack/VideoTrack.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function VideoTrack({ track, isLocal, priority }: VideoTrackProps
4646
// The local video track is mirrored if it is not facing the environment.
4747
const isFrontFacing = mediaStreamTrack?.getSettings().facingMode !== 'environment';
4848
const style = {
49-
transform: isLocal && isFrontFacing ? 'rotateY(180deg)' : '',
49+
transform: isLocal && isFrontFacing ? 'scaleX(-1)' : '',
5050
objectFit: isPortrait || track.name.includes('screen') ? ('contain' as const) : ('cover' as const),
5151
};
5252

0 commit comments

Comments
 (0)