@@ -279,6 +279,7 @@ export function GroupCallView({
|
|||||||
setUserChoices(choices);
|
setUserChoices(choices);
|
||||||
enter();
|
enter();
|
||||||
}}
|
}}
|
||||||
|
muteAudio={participants.size > 8}
|
||||||
isEmbedded={isEmbedded}
|
isEmbedded={isEmbedded}
|
||||||
hideHeader={hideHeader}
|
hideHeader={hideHeader}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -97,20 +97,7 @@ export interface ActiveCallProps extends Omit<InCallViewProps, "livekitRoom"> {
|
|||||||
|
|
||||||
export function ActiveCall(props: ActiveCallProps) {
|
export function ActiveCall(props: ActiveCallProps) {
|
||||||
const sfuConfig = useSFUConfig();
|
const sfuConfig = useSFUConfig();
|
||||||
const livekitRoom = useLiveKit(
|
const livekitRoom = useLiveKit(props.userChoices, sfuConfig);
|
||||||
{
|
|
||||||
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) {
|
if (!livekitRoom) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ interface Props {
|
|||||||
onEnter: (userChoices: UserChoices) => void;
|
onEnter: (userChoices: UserChoices) => void;
|
||||||
isEmbedded: boolean;
|
isEmbedded: boolean;
|
||||||
hideHeader: boolean;
|
hideHeader: boolean;
|
||||||
|
muteAudio: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LobbyView(props: Props) {
|
export function LobbyView(props: Props) {
|
||||||
@@ -66,6 +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}
|
||||||
onUserChoicesChanged={setUserChoices}
|
onUserChoicesChanged={setUserChoices}
|
||||||
/>
|
/>
|
||||||
<Trans>
|
<Trans>
|
||||||
|
|||||||
@@ -40,10 +40,15 @@ export type MatrixInfo = {
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
matrixInfo: MatrixInfo;
|
matrixInfo: MatrixInfo;
|
||||||
|
muteAudio: boolean;
|
||||||
onUserChoicesChanged: (choices: UserChoices) => void;
|
onUserChoicesChanged: (choices: UserChoices) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function VideoPreview({ matrixInfo, onUserChoicesChanged }: Props) {
|
export function VideoPreview({
|
||||||
|
matrixInfo,
|
||||||
|
muteAudio,
|
||||||
|
onUserChoicesChanged,
|
||||||
|
}: Props) {
|
||||||
const { client } = useClient();
|
const { client } = useClient();
|
||||||
const [previewRef, previewBounds] = useMeasure({ polyfill: ResizeObserver });
|
const [previewRef, previewBounds] = useMeasure({ polyfill: ResizeObserver });
|
||||||
|
|
||||||
@@ -64,7 +69,13 @@ export function VideoPreview({ matrixInfo, onUserChoicesChanged }: Props) {
|
|||||||
|
|
||||||
// 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>(true);
|
const [audioEnabled, setAudioEnabled] = useState<boolean>(!muteAudio);
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user