Skip to content

Commit

Permalink
fix: flip cam showing twice
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Aug 24, 2023
1 parent 1c3892d commit 8889072
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { Fragment } from 'react';
import {
DeviceType,
HMSRoomState,
selectLocalVideoTrackID,
selectRoomState,
selectVideoTrackByID,
useAVToggle,
useDevices,
Expand Down Expand Up @@ -64,6 +66,7 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
const actions = useHMSActions();
const videoTrackId = useHMSStore(selectLocalVideoTrackID);
const localVideoTrack = useHMSStore(selectVideoTrackByID(videoTrackId));
const roomState = useHMSStore(selectRoomState);

return (
<Fragment>
Expand Down Expand Up @@ -137,7 +140,7 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
)
) : null}

{localVideoTrack?.facingMode && !hideOptions ? (
{localVideoTrack?.facingMode && roomState === HMSRoomState.Preview ? (
<Tooltip title="Switch Camera" key="switchCamera">
<IconButton
onClick={async () => {
Expand Down

0 comments on commit 8889072

Please sign in to comment.