From 973d3962495ccd1776921d73e9e4eb97073929cd Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Sep 2023 17:34:55 +0100 Subject: [PATCH 1/5] Remove extra device request on the video preview page As per comment, livekit mutates the object that's passed in, so we ended up re-requesting the devices in the next render because we effectively passed in different options. --- src/main.tsx | 6 +++--- src/room/VideoPreview.tsx | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index d04a3a94..efc6e8d7 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -57,7 +57,7 @@ Initializer.initBeforeReact(); const history = createBrowserHistory(); root.render( - - - + // + + // ); diff --git a/src/room/VideoPreview.tsx b/src/room/VideoPreview.tsx index 1b5c07ce..044a3221 100644 --- a/src/room/VideoPreview.tsx +++ b/src/room/VideoPreview.tsx @@ -68,6 +68,9 @@ export const VideoPreview: FC = ({ matrixInfo, muteStates }) => { const devices = useMediaDevices(); + // Capture the audio options as they were when we first mounted, because + // we're not doing anything with the audio anyway so we don't need to + // re-open the devices when they change (see below). const initialAudioOptions = useRef(); initialAudioOptions.current ??= muteStates.audio.enabled && { deviceId: devices.audioInput.selectedId, @@ -79,7 +82,9 @@ export const VideoPreview: FC = ({ matrixInfo, muteStates }) => { // 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 // reference the initial values here. - audio: initialAudioOptions.current, + // We also pass in a clone because livekit mutates the object passed in, + // which would cause the devices to be re-opened on the next render. + audio: Object.assign({}, initialAudioOptions.current), video: muteStates.video.enabled && { deviceId: devices.videoInput.selectedId, }, From 3e726043914365d9999d165837a0f4f031057677 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Sep 2023 17:38:43 +0100 Subject: [PATCH 2/5] Remove unintentional change --- src/main.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index efc6e8d7..d04a3a94 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -57,7 +57,7 @@ Initializer.initBeforeReact(); const history = createBrowserHistory(); root.render( - // - - // + + + ); From 00f14c98143c0511c85a8b4a7d87f28fca970c43 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Sep 2023 11:45:01 +0100 Subject: [PATCH 3/5] Fix the mute icon being incorrect when using PTT We were manipulating the participant's mute state directly for some reason, just for setting the mute state directly, which bypased the mutestates hook. --- src/room/InCallView.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 1d3701bc..9bb2a4d9 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -190,7 +190,8 @@ export function InCallView({ containerRef1, toggleMicrophone, toggleCamera, - async (muted) => await localParticipant.setMicrophoneEnabled(!muted) + (muted) => + muteStates?.audio?.setEnabled && muteStates.audio.setEnabled(!muted) ); const onDisconnected = useCallback( From 38bb2895db59f25517eec9692eed72ae95f52436 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 7 Sep 2023 13:16:40 +0100 Subject: [PATCH 4/5] Tidier syntax Co-authored-by: Robin --- src/room/InCallView.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 9bb2a4d9..1eeafece 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -190,8 +190,7 @@ export function InCallView({ containerRef1, toggleMicrophone, toggleCamera, - (muted) => - muteStates?.audio?.setEnabled && muteStates.audio.setEnabled(!muted) + (muted) => muteStates.audio.setEnabled?.(!muted) ); const onDisconnected = useCallback( From 7fc0de573b877cfcf92740588585fd01c1092b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sun, 10 Sep 2023 11:50:09 +0200 Subject: [PATCH 5/5] Remove leftover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/video-grid/VideoTile.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/video-grid/VideoTile.tsx b/src/video-grid/VideoTile.tsx index 3433f8aa..ceaf7e1e 100644 --- a/src/video-grid/VideoTile.tsx +++ b/src/video-grid/VideoTile.tsx @@ -145,8 +145,6 @@ export const VideoTile = forwardRef( // Firefox doesn't respect the disablePictureInPicture attribute // https://bugzilla.mozilla.org/show_bug.cgi?id=1611831 - console.log(`LOG VideoTIle mxcSrc=${member?.getMxcAvatarUrl()}`); - return (