From 4dcd1e176f5684fae54d619820e7fca00b5ef120 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:35:54 +0200 Subject: [PATCH] respect mute state set in lobby for call (#1102) Signed-off-by: Timo K --- src/room/GroupCallView.tsx | 4 ++++ src/room/InCallView.tsx | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 9e8a389..098cbde 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -183,6 +183,10 @@ export function GroupCallView({ matrixInfo={matrixInfo} mediaDevices={lkState.mediaDevices} livekitRoom={lkState.room} + userChoices={{ + videoMuted: lkState.localMedia.video.muted, + audioMuted: lkState.localMedia.audio.muted, + }} /> ); } else if (left) { diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 6382cb8..c1414e2 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -81,6 +81,11 @@ const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); // For now we can disable screensharing in Safari. const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); +interface LocalUserChoices { + videoMuted: boolean; + audioMuted: boolean; +} + interface Props { client: MatrixClient; groupCall: GroupCall; @@ -92,6 +97,8 @@ interface Props { matrixInfo: MatrixInfo; mediaDevices: MediaDevicesState; livekitRoom: Room; + + userChoices: LocalUserChoices; } export function InCallView({ @@ -104,6 +111,7 @@ export function InCallView({ matrixInfo, mediaDevices, livekitRoom, + userChoices, }: Props) { const { t } = useTranslation(); usePreventScroll(); @@ -143,8 +151,8 @@ export function InCallView({ token, serverUrl: Config.get().livekit.server_url, room: livekitRoom, - audio: true, - video: true, + audio: !userChoices.audioMuted, + video: !userChoices.videoMuted, onConnected: () => { console.log("connected to LiveKit room"); },