diff --git a/web/src/stores/voice.ts b/web/src/stores/voice.ts index a9d43d6..26ac1b3 100644 --- a/web/src/stores/voice.ts +++ b/web/src/stores/voice.ts @@ -174,7 +174,8 @@ export const useVoiceStore = create((set, get) => ({ syncParticipants(); }); - room.on(RoomEvent.Disconnected, () => { + room.on(RoomEvent.Disconnected, (reason?: any) => { + console.warn('[voice] disconnected, reason:', reason); set({ isConnected: false, currentRoom: null, @@ -187,6 +188,30 @@ export const useVoiceStore = create((set, get) => ({ }); }); + room.on(RoomEvent.Reconnecting, () => { + console.warn('[voice] reconnecting to LiveKit...'); + set({ error: 'Reconnecting...' }); + }); + + room.on(RoomEvent.Reconnected, () => { + console.log('[voice] reconnected to LiveKit'); + set({ error: null }); + syncParticipants(); + }); + + room.on(RoomEvent.SignalConnected, () => { + console.log('[voice] signal channel connected'); + }); + + room.on(RoomEvent.ConnectionQualityChanged, (_quality: any, participant: Participant) => { + if (participant.identity === room.localParticipant.identity) { + // if quality drops to poor, log it + if (_quality === 'poor') { + console.warn('[voice] poor connection quality'); + } + } + }); + room.on(RoomEvent.ParticipantConnected, () => { syncParticipants(); });