From 3a2cee581e3315e88cb761606f66dc46174aaabe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 27 Jun 2023 17:25:35 +0200 Subject: [PATCH] Get LK info from the js-sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/ClientContext.tsx | 12 ++++++++++++ src/room/InCallView.tsx | 5 ++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ClientContext.tsx b/src/ClientContext.tsx index 08593a4..acd9511 100644 --- a/src/ClientContext.tsx +++ b/src/ClientContext.tsx @@ -138,6 +138,16 @@ export const ClientProvider: FC = ({ children }) => { const { user_id, device_id, access_token, passwordlessUser } = session; + const livekit = Config.get().livekit; + const foci = livekit + ? [ + { + url: livekit.server_url, + jwtServiceUrl: livekit.jwt_service_url, + }, + ] + : undefined; + try { return { client: await initClient( @@ -147,6 +157,7 @@ export const ClientProvider: FC = ({ children }) => { userId: user_id, deviceId: device_id, fallbackICEServerAllowed: fallbackICEServerAllowed, + foci, }, true ), @@ -163,6 +174,7 @@ export const ClientProvider: FC = ({ children }) => { userId: user_id, deviceId: device_id, fallbackICEServerAllowed: fallbackICEServerAllowed, + foci, }, false // Don't need the crypto store just to log out ); diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 7125720..07f3252 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -72,7 +72,6 @@ import { MatrixInfo } from "./VideoPreview"; import { useJoinRule } from "./useJoinRule"; import { ParticipantInfo } from "./useGroupCall"; import { ItemData, TileContent } from "../video-grid/VideoTile"; -import { Config } from "../config/Config"; import { NewVideoGrid } from "../video-grid/NewVideoGrid"; import { OTelGroupCallMembership } from "../otel/OTelGroupCallMembership"; import { SettingsModal } from "../settings/SettingsModal"; @@ -96,8 +95,8 @@ interface ActiveCallProps extends Omit { export function ActiveCall(props: ActiveCallProps) { const livekitRoom = useLiveKit(props.userChoices, { - sfuUrl: Config.get().livekit!.server_url, - jwtUrl: `${Config.get().livekit!.jwt_service_url}/token`, + sfuUrl: props.groupCall.foci[0]!.url, + jwtUrl: `${props.groupCall.foci[0]!.jwtServiceUrl}/token`, roomName: props.matrixInfo.roomName, userDisplayName: props.matrixInfo.displayName, userIdentity: `${props.client.getUserId()}:${props.client.getDeviceId()}`,