@@ -41,7 +41,7 @@ import { ActiveCall } from "./InCallView";
|
|||||||
import { MUTE_PARTICIPANT_COUNT, type MuteStates } from "./MuteStates";
|
import { MUTE_PARTICIPANT_COUNT, type MuteStates } from "./MuteStates";
|
||||||
import { useMediaDevices } from "../MediaDevicesContext";
|
import { useMediaDevices } from "../MediaDevicesContext";
|
||||||
import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships";
|
import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships";
|
||||||
import { enterRTCSession, leaveRTCSession } from "../rtcSessionHelpers";
|
import { leaveRTCSession } from "../rtcSessionHelpers";
|
||||||
import {
|
import {
|
||||||
saveKeyForRoom,
|
saveKeyForRoom,
|
||||||
useRoomEncryptionSystem,
|
useRoomEncryptionSystem,
|
||||||
@@ -90,7 +90,8 @@ interface Props {
|
|||||||
skipLobby: UrlParams["skipLobby"];
|
skipLobby: UrlParams["skipLobby"];
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -103,7 +104,8 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
skipLobby,
|
skipLobby,
|
||||||
header,
|
header,
|
||||||
rtcSession,
|
rtcSession,
|
||||||
isJoined,
|
joined,
|
||||||
|
setJoined,
|
||||||
muteStates,
|
muteStates,
|
||||||
widget,
|
widget,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -213,12 +215,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);
|
||||||
@@ -230,12 +234,9 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
setExternalError(error);
|
setExternalError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
[
|
[setJoined],
|
||||||
perParticipantE2EE,
|
|
||||||
useExperimentalToDeviceTransport,
|
|
||||||
useNewMembershipManager,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -284,7 +285,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
await defaultDeviceSetup(ev.detail.data as unknown as JoinCallData);
|
await defaultDeviceSetup(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 on preload", e);
|
logger.error("Error joining RTC session on preload", e);
|
||||||
@@ -296,11 +297,7 @@ 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> => {
|
setJoined(true);
|
||||||
await enterRTCSessionOrError(rtcSession);
|
|
||||||
})().catch((e) => {
|
|
||||||
logger.error("Error joining RTC session immediately", e);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -311,7 +308,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
perParticipantE2EE,
|
perParticipantE2EE,
|
||||||
mediaDevices,
|
mediaDevices,
|
||||||
latestMuteStates,
|
latestMuteStates,
|
||||||
enterRTCSessionOrError,
|
setJoined,
|
||||||
useNewMembershipManager,
|
useNewMembershipManager,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -373,7 +370,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 +388,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 +423,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 +441,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