feat(voice): add setMuted() idempotent setter and pttActive state for PTT keybinds

This commit is contained in:
Jannis Braun
2026-03-22 20:23:23 +01:00
parent 7694f732c9
commit 063d73cff1
+7
View File
@@ -79,6 +79,9 @@ interface VoiceState {
setOutputVolume: (volume: number) => void;
setInputDevice: (deviceId: string) => void;
setOutputDevice: (deviceId: string) => void;
pttActive: boolean;
setMuted: (muted: boolean) => void;
setPttActive: (active: boolean) => void;
toggleMic: () => void;
toggleCamera: () => void;
toggleScreenShare: () => void;
@@ -122,6 +125,7 @@ export const useVoiceStore = create<VoiceState>()(
voiceUsers: new Map(),
currentVoiceChannelId: null,
isMuted: false,
pttActive: false,
isDeafened: false,
isCameraOn: false,
isScreenSharing: false,
@@ -290,6 +294,9 @@ export const useVoiceStore = create<VoiceState>()(
setOutputDevice: (deviceId) => set({ outputDeviceId: deviceId }),
setMuted: (muted: boolean) => set({ isMuted: muted }),
setPttActive: (active: boolean) => set({ pttActive: active }),
toggleMic: () => set((state) => {
// User intent toggle — effective state (intent || serverEnforcement) is
// computed at broadcast/hardware time, so the mic stays off while server-muted