diff --git a/app/products/calls/connection/connection.ts b/app/products/calls/connection/connection.ts index f02dec4ec8..692a1809a0 100644 --- a/app/products/calls/connection/connection.ts +++ b/app/products/calls/connection/connection.ts @@ -231,15 +231,15 @@ export async function newConnection(serverUrl: string, channelID: string, closeC ws.on('message', ({data}: { data: string }) => { const msg = JSON.parse(data); - if (msg.type === 'answer' || msg.type === 'offer') { + if (msg.type === 'answer' || msg.type === 'candidate' || msg.type === 'offer') { peer?.signal(data); } }); const waitForPeerConnection = () => { - const waitForReadyImpl = (callback: () => void, fail: () => void, timeout: number) => { + const waitForReadyImpl = (callback: () => void, fail: (reason: string) => void, timeout: number) => { if (timeout <= 0) { - fail(); + fail('timed out waiting for peer connection'); return; } setTimeout(() => { diff --git a/app/products/calls/state/actions.ts b/app/products/calls/state/actions.ts index 28f0fb1550..4bfe8976bb 100644 --- a/app/products/calls/state/actions.ts +++ b/app/products/calls/state/actions.ts @@ -131,6 +131,12 @@ export const userLeftCall = (serverUrl: string, channelId: string, userId: strin return; } + // Was the user me? + if (userId === callsState.myUserId) { + myselfLeftCall(); + return; + } + const nextCurrentCall = { ...currentCall, participants: {...currentCall.participants},