From 540afbd246eeca12a5f0303642b05ce24040ada3 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 7 Apr 2026 12:15:21 +0200 Subject: [PATCH] Always wait for local transport --- .../CallViewModel/remoteMembers/ConnectionManager.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/state/CallViewModel/remoteMembers/ConnectionManager.ts b/src/state/CallViewModel/remoteMembers/ConnectionManager.ts index 727f68bc..e02505de 100644 --- a/src/state/CallViewModel/remoteMembers/ConnectionManager.ts +++ b/src/state/CallViewModel/remoteMembers/ConnectionManager.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. */ import { type LivekitTransportConfig } from "matrix-js-sdk/lib/matrixrtc"; -import { combineLatest, map, of, switchMap } from "rxjs"; +import { combineLatest, map, of, skipWhile, switchMap } from "rxjs"; import { type Logger } from "matrix-js-sdk/lib/logger"; import { type RemoteParticipant } from "livekit-client"; import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager"; @@ -131,6 +131,12 @@ export function createConnectionManager$({ // Combine local and remote transports into one transport array // and set the forceOldJwtEndpoint property on the local transport map(([remoteTransports, localTransport]) => { + if (!localTransport) { + // Dont return any transports as long as there is no local transport. + // Otherwise we might end up with two connections since the local transport will already connect to the SFU. + // The local transport needs to connect with dedicated logic to also setup delayed event delegation. + return new Epoch([]); + } let localTransportAsArray: LocalTransportWithSFUConfig[] = []; if (localTransport) { localTransportAsArray = [localTransport];