Revert "Fix mute flickering. (#2350)" (#2351)

This reverts commit 2ab909fab1.
This commit is contained in:
Timo 2024-04-30 20:08:39 +02:00 committed by GitHub
parent 2ab909fab1
commit 51926cad3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
@ -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