Don't change mute state while in the lobby

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2023-07-25 13:40:22 +02:00
parent 71311efc7e
commit a6f803a091
4 changed files with 11 additions and 13 deletions

View File

@@ -229,6 +229,8 @@ export function GroupCallView({
groupCall.enter(); groupCall.enter();
}, [groupCall]); }, [groupCall]);
console.log("LOG participant size", participants.size);
if (error) { if (error) {
return <ErrorView error={error} />; return <ErrorView error={error} />;
} else if (state === GroupCallState.Entered && userChoices) { } else if (state === GroupCallState.Entered && userChoices) {
@@ -293,7 +295,7 @@ export function GroupCallView({
setUserChoices(choices); setUserChoices(choices);
enter(); enter();
}} }}
muteAudio={participants.size > 8} initWithMutedAudio={participants.size > 0}
isEmbedded={isEmbedded} isEmbedded={isEmbedded}
hideHeader={hideHeader} hideHeader={hideHeader}
/> />

View File

@@ -33,7 +33,7 @@ interface Props {
onEnter: (userChoices: UserChoices) => void; onEnter: (userChoices: UserChoices) => void;
isEmbedded: boolean; isEmbedded: boolean;
hideHeader: boolean; hideHeader: boolean;
muteAudio: boolean; initWithMutedAudio: boolean;
} }
export function LobbyView(props: Props) { export function LobbyView(props: Props) {
@@ -67,7 +67,7 @@ export function LobbyView(props: Props) {
<div className={styles.joinRoomContent}> <div className={styles.joinRoomContent}>
<VideoPreview <VideoPreview
matrixInfo={props.matrixInfo} matrixInfo={props.matrixInfo}
muteAudio={props.muteAudio} initWithMutedAudio={props.initWithMutedAudio}
onUserChoicesChanged={setUserChoices} onUserChoicesChanged={setUserChoices}
/> />
<Trans> <Trans>

View File

@@ -40,13 +40,13 @@ export type MatrixInfo = {
interface Props { interface Props {
matrixInfo: MatrixInfo; matrixInfo: MatrixInfo;
muteAudio: boolean; initWithMutedAudio: boolean;
onUserChoicesChanged: (choices: UserChoices) => void; onUserChoicesChanged: (choices: UserChoices) => void;
} }
export function VideoPreview({ export function VideoPreview({
matrixInfo, matrixInfo,
muteAudio, initWithMutedAudio,
onUserChoicesChanged, onUserChoicesChanged,
}: Props) { }: Props) {
const { client } = useClient(); const { client } = useClient();
@@ -69,13 +69,9 @@ export function VideoPreview({
// Create local media tracks. // Create local media tracks.
const [videoEnabled, setVideoEnabled] = useState<boolean>(true); const [videoEnabled, setVideoEnabled] = useState<boolean>(true);
const [audioEnabled, setAudioEnabled] = useState<boolean>(!muteAudio); const [audioEnabled, setAudioEnabled] = useState<boolean>(
!initWithMutedAudio
useEffect(() => { );
if (muteAudio) {
setAudioEnabled(false);
}
}, [muteAudio]);
// The settings are updated as soon as the device changes. We wrap the settings value in a ref to store their initial value. // The settings are updated as soon as the device changes. We wrap the settings value in a ref to store their initial value.
// Not changing the device options prohibits the usePreviewTracks hook to recreate the tracks. // Not changing the device options prohibits the usePreviewTracks hook to recreate the tracks.

View File

@@ -171,7 +171,7 @@ export function useGroupCall(
isScreensharing: false, isScreensharing: false,
screenshareFeeds: [], screenshareFeeds: [],
requestingScreenshare: false, requestingScreenshare: false,
participants: new Map(), participants: getParticipants(groupCall),
hasLocalParticipant: false, hasLocalParticipant: false,
}); });