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;