Skip to content

Commit

Permalink
Revert "Fix mute flickering. (#2350)" (#2351)
Browse files Browse the repository at this point in the history
This reverts commit 2ab909f.
  • Loading branch information
toger5 authored Apr 30, 2024
1 parent 2ab909f commit 51926ca
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/room/VideoPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const VideoPreview: FC<Props> = ({
deviceId: devices.audioInput.selectedId,
};

const deviceConfig = useMemo(() => {
return {
const tracks = usePreviewTracks(
{
// The only reason we request audio here is to get the audio permission
// request over with at the same time. But changing the audio settings
// shouldn't cause this hook to recreate the track, which is why we
Expand All @@ -80,15 +80,13 @@ export const VideoPreview: FC<Props> = ({
video: muteStates.video.enabled && {
deviceId: devices.videoInput.selectedId,
},
};
}, [devices.videoInput.selectedId, muteStates.video.enabled]);

const tracks = usePreviewTracks(deviceConfig, (error) => {
logger.error("Error while creating preview Tracks:", error);
muteStates.audio.setEnabled?.(false);
muteStates.video.setEnabled?.(false);
});

},
(error) => {
logger.error("Error while creating preview Tracks:", error);
muteStates.audio.setEnabled?.(false);
muteStates.video.setEnabled?.(false);
},
);
const videoTrack = useMemo(
() =>
tracks?.find((t) => t.kind === Track.Kind.Video) as
Expand Down

0 comments on commit 51926ca

Please sign in to comment.