fix: resolve LiveKit voice/video stability issues
- Guard Disconnected/ConnectionStateChanged event handlers against stale rooms: old room events no longer nuke the new room's state (root cause of buttons failing, mute getting stuck, DUPLICATE_IDENTITY cascades) - Reset media state (isMuted/isCameraOn/isScreenSharing) on connect to prevent desync after reconnects - Add voiceStates to WS ready payload so users see who's in voice on page load - Wire VoiceControls buttons to check getActiveRoom() before SDK calls - Guard ChannelSidebar against re-joining the same voice channel - Switch LIVEKIT_URL to wss://nova.ddns.net/livekit for HTTPS secure context (required for getUserMedia in Safari)
This commit is contained in:
@@ -379,7 +379,21 @@ function buildReadyPayload(userId: string): {
|
||||
});
|
||||
}
|
||||
|
||||
return { user, servers, dmChannels, folders };
|
||||
// Build voice states — tell the client who is currently in voice channels
|
||||
// across all their servers
|
||||
const voiceStates: Record<string, string[]> = {};
|
||||
for (const srv of servers) {
|
||||
for (const ch of srv.channels) {
|
||||
if (ch.type === 'voice' || ch.type === 'video') {
|
||||
const users = connectionManager.getVoiceUsers(ch.id);
|
||||
if (users.size > 0) {
|
||||
voiceStates[ch.id] = Array.from(users);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { user, servers, dmChannels, folders, voiceStates };
|
||||
}
|
||||
|
||||
export async function registerWebSocket(app: FastifyInstance): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user