fix: broadcast camera & screen share status via WebSocket for sidebar visibility
Camera and LIVE badges in the channel sidebar were only visible to users
who had joined the same LiveKit room. Widen the voice_status WS event
from {isMuted, isDeafened} to {isMuted, isDeafened, isCameraOn, isScreenSharing}
so all server members see camera/screenshare indicators without joining voice.
This commit is contained in:
@@ -75,8 +75,8 @@ interface VoiceState {
|
||||
deafenedUserIds: Set<string>;
|
||||
setUserDeafened: (userId: string, deafened: boolean) => void;
|
||||
// WebSocket-based voice user status (visible without joining LiveKit)
|
||||
voiceUserStates: Map<string, { isMuted: boolean; isDeafened: boolean }>;
|
||||
setVoiceUserStatus: (userId: string, isMuted: boolean, isDeafened: boolean) => void;
|
||||
voiceUserStates: Map<string, { isMuted: boolean; isDeafened: boolean; isCameraOn: boolean; isScreenSharing: boolean }>;
|
||||
setVoiceUserStatus: (userId: string, isMuted: boolean, isDeafened: boolean, isCameraOn: boolean, isScreenSharing: boolean) => void;
|
||||
clearVoiceUserStatus: (userId: string) => void;
|
||||
getVoiceUsers: (channelId: string) => string[];
|
||||
clearAllVoiceUsers: () => void;
|
||||
@@ -247,10 +247,10 @@ export const useVoiceStore = create<VoiceState>()(
|
||||
},
|
||||
|
||||
voiceUserStates: new Map(),
|
||||
setVoiceUserStatus: (userId, isMuted, isDeafened) => {
|
||||
setVoiceUserStatus: (userId, isMuted, isDeafened, isCameraOn, isScreenSharing) => {
|
||||
set((state) => {
|
||||
const newMap = new Map(state.voiceUserStates);
|
||||
newMap.set(userId, { isMuted, isDeafened });
|
||||
newMap.set(userId, { isMuted, isDeafened, isCameraOn, isScreenSharing });
|
||||
return { voiceUserStates: newMap };
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user