mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
@@ -87,7 +87,8 @@ interface Props {
|
|||||||
skipLobby: boolean;
|
skipLobby: boolean;
|
||||||
header: HeaderStyle;
|
header: HeaderStyle;
|
||||||
rtcSession: MatrixRTCSession;
|
rtcSession: MatrixRTCSession;
|
||||||
isJoined: boolean;
|
joined: boolean;
|
||||||
|
setJoined: (value: boolean) => void;
|
||||||
muteStates: MuteStates;
|
muteStates: MuteStates;
|
||||||
widget: WidgetHelpers | null;
|
widget: WidgetHelpers | null;
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,8 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
skipLobby,
|
skipLobby,
|
||||||
header,
|
header,
|
||||||
rtcSession,
|
rtcSession,
|
||||||
isJoined,
|
joined,
|
||||||
|
setJoined,
|
||||||
muteStates,
|
muteStates,
|
||||||
widget,
|
widget,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -210,12 +212,14 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
const enterRTCSessionOrError = useCallback(
|
const enterRTCSessionOrError = useCallback(
|
||||||
async (rtcSession: MatrixRTCSession): Promise<void> => {
|
async (rtcSession: MatrixRTCSession): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
await enterRTCSession(
|
setJoined(true);
|
||||||
rtcSession,
|
// TODO-MULTI-SFU what to do with error handling now that we don't use this function?
|
||||||
perParticipantE2EE,
|
// await enterRTCSession(
|
||||||
useNewMembershipManager,
|
// rtcSession,
|
||||||
useExperimentalToDeviceTransport,
|
// perParticipantE2EE,
|
||||||
);
|
// useNewMembershipManager,
|
||||||
|
// useExperimentalToDeviceTransport,
|
||||||
|
// );
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof ElementCallError) {
|
if (e instanceof ElementCallError) {
|
||||||
setExternalError(e);
|
setExternalError(e);
|
||||||
@@ -227,12 +231,9 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
setExternalError(error);
|
setExternalError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
[
|
[],
|
||||||
perParticipantE2EE,
|
|
||||||
useExperimentalToDeviceTransport,
|
|
||||||
useNewMembershipManager,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -284,7 +285,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
await defaultDeviceSetup(
|
await defaultDeviceSetup(
|
||||||
ev.detail.data as unknown as JoinCallData,
|
ev.detail.data as unknown as JoinCallData,
|
||||||
);
|
);
|
||||||
await enterRTCSessionOrError(rtcSession);
|
setJoined(true);
|
||||||
widget.api.transport.reply(ev.detail, {});
|
widget.api.transport.reply(ev.detail, {});
|
||||||
})().catch((e) => {
|
})().catch((e) => {
|
||||||
logger.error("Error joining RTC session", e);
|
logger.error("Error joining RTC session", e);
|
||||||
@@ -297,13 +298,13 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
} else {
|
} else {
|
||||||
// No lobby and no preload: we enter the rtc session right away
|
// No lobby and no preload: we enter the rtc session right away
|
||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
await enterRTCSessionOrError(rtcSession);
|
setJoined(true);
|
||||||
})().catch((e) => {
|
})().catch((e) => {
|
||||||
logger.error("Error joining RTC session", e);
|
logger.error("Error joining RTC session", e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
void enterRTCSessionOrError(rtcSession);
|
setJoined(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -314,7 +315,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
perParticipantE2EE,
|
perParticipantE2EE,
|
||||||
mediaDevices,
|
mediaDevices,
|
||||||
latestMuteStates,
|
latestMuteStates,
|
||||||
enterRTCSessionOrError,
|
setJoined,
|
||||||
useNewMembershipManager,
|
useNewMembershipManager,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -373,7 +374,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (widget && isJoined) {
|
if (widget && joined) {
|
||||||
// set widget to sticky once joined.
|
// set widget to sticky once joined.
|
||||||
widget.api.setAlwaysOnScreen(true).catch((e) => {
|
widget.api.setAlwaysOnScreen(true).catch((e) => {
|
||||||
logger.error("Error calling setAlwaysOnScreen(true)", e);
|
logger.error("Error calling setAlwaysOnScreen(true)", e);
|
||||||
@@ -391,7 +392,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
widget.lazyActions.off(ElementWidgetActions.HangupCall, onHangup);
|
widget.lazyActions.off(ElementWidgetActions.HangupCall, onHangup);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [widget, isJoined, rtcSession]);
|
}, [widget, joined, rtcSession]);
|
||||||
|
|
||||||
const joinRule = useJoinRule(room);
|
const joinRule = useJoinRule(room);
|
||||||
|
|
||||||
@@ -426,7 +427,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
client={client}
|
client={client}
|
||||||
matrixInfo={matrixInfo}
|
matrixInfo={matrixInfo}
|
||||||
muteStates={muteStates}
|
muteStates={muteStates}
|
||||||
onEnter={() => void enterRTCSessionOrError(rtcSession)}
|
onEnter={() => setJoined(true)}
|
||||||
confineToRoom={confineToRoom}
|
confineToRoom={confineToRoom}
|
||||||
hideHeader={header === HeaderStyle.None}
|
hideHeader={header === HeaderStyle.None}
|
||||||
participantCount={participantCount}
|
participantCount={participantCount}
|
||||||
@@ -444,7 +445,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
throw externalError;
|
throw externalError;
|
||||||
};
|
};
|
||||||
body = <ErrorComponent />;
|
body = <ErrorComponent />;
|
||||||
} else if (isJoined) {
|
} else if (joined) {
|
||||||
body = (
|
body = (
|
||||||
<>
|
<>
|
||||||
{shareModal}
|
{shareModal}
|
||||||
|
|||||||
@@ -61,10 +61,8 @@ export const RoomPage: FC = () => {
|
|||||||
const { avatarUrl, displayName: userDisplayName } = useProfile(client);
|
const { avatarUrl, displayName: userDisplayName } = useProfile(client);
|
||||||
|
|
||||||
const groupCallState = useLoadGroupCall(client, roomIdOrAlias, viaServers);
|
const groupCallState = useLoadGroupCall(client, roomIdOrAlias, viaServers);
|
||||||
const isJoined = useMatrixRTCSessionJoinState(
|
const [joined, setJoined] = useState(false);
|
||||||
groupCallState.kind === "loaded" ? groupCallState.rtcSession : undefined,
|
const muteStates = useMuteStates(joined);
|
||||||
);
|
|
||||||
const muteStates = useMuteStates(isJoined);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// If we've finished loading, are not already authed and we've been given a display name as
|
// If we've finished loading, are not already authed and we've been given a display name as
|
||||||
@@ -109,7 +107,8 @@ export const RoomPage: FC = () => {
|
|||||||
widget={widget}
|
widget={widget}
|
||||||
client={client!}
|
client={client!}
|
||||||
rtcSession={groupCallState.rtcSession}
|
rtcSession={groupCallState.rtcSession}
|
||||||
isJoined={isJoined}
|
joined={joined}
|
||||||
|
setJoined={setJoined}
|
||||||
isPasswordlessUser={passwordlessUser}
|
isPasswordlessUser={passwordlessUser}
|
||||||
confineToRoom={confineToRoom}
|
confineToRoom={confineToRoom}
|
||||||
preload={preload}
|
preload={preload}
|
||||||
|
|||||||
Reference in New Issue
Block a user