From 8ee0e207bd9451a914460b8f0c6980e05e06267b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 24 Jul 2023 12:06:51 +0200 Subject: [PATCH] Automatically mute the user, if there already are more than 8 participants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/livekit/useLiveKit.ts | 2 +- src/room/InCallView.tsx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index dac6a052..adb5c72c 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -11,7 +11,7 @@ export type UserChoices = { }; export type DeviceChoices = { - selectedId: string; + selectedId?: string; enabled: boolean; }; diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index c45edbc2..866c75af 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -97,7 +97,20 @@ export interface ActiveCallProps extends Omit { export function ActiveCall(props: ActiveCallProps) { const sfuConfig = useSFUConfig(); - const livekitRoom = useLiveKit(props.userChoices, sfuConfig); + const livekitRoom = useLiveKit( + { + audio: { + selectedId: props.userChoices.audio?.selectedId, + enabled: + (props.userChoices.audio?.enabled ?? false) && + // Automatically mute the user, if there is more than 8 participants + // in the call + props.groupCall.participants.size <= 8, + }, + video: props.userChoices.video, + }, + sfuConfig + ); if (!livekitRoom) { return null;