Automatically mute the user, if there already are more than 8 participants

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2023-07-24 12:06:51 +02:00
parent 4cc2d87c90
commit 8ee0e207bd
2 changed files with 15 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ export type UserChoices = {
};
export type DeviceChoices = {
selectedId: string;
selectedId?: string;
enabled: boolean;
};

View File

@@ -97,7 +97,20 @@ export interface ActiveCallProps extends Omit<InCallViewProps, "livekitRoom"> {
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;