From 51cc406af7a28a64fef8c921ede4ed77266f5fe3 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 9 Apr 2024 10:06:34 -0400 Subject: [PATCH] Experiment with different timeouts This lets you set the global variables peerConnectionTimeout and websocketTimeout to see what LiveKit does with different values. --- src/livekit/useECConnectionState.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/livekit/useECConnectionState.ts b/src/livekit/useECConnectionState.ts index 1ca3b675..e874fca1 100644 --- a/src/livekit/useECConnectionState.ts +++ b/src/livekit/useECConnectionState.ts @@ -28,6 +28,13 @@ import * as Sentry from "@sentry/react"; import { SFUConfig, sfuConfigEquals } from "./openIDSFU"; +declare global { + interface Window { + peerConnectionTimeout?: number; + websocketTimeout?: number; + } +} + /* * Additional values for states that a call can be in, beyond what livekit * provides in ConnectionState. Also reconnects the call if the SFU Config @@ -124,7 +131,12 @@ async function connectAndPublish( micTrack: LocalTrack | undefined, screenshareTracks: MediaStreamTrack[], ): Promise { - await livekitRoom!.connect(sfuConfig!.url, sfuConfig!.jwt); + await livekitRoom!.connect(sfuConfig!.url, sfuConfig!.jwt, { + // Due to stability issues on Firefox we are testing the effect of different + // timeouts, and allow these values to be set through the console + peerConnectionTimeout: window.peerConnectionTimeout ?? 45000, + websocketTimeout: window.websocketTimeout ?? 45000, + }); if (micTrack) { logger.info(`Publishing precreated mic track`);