voice v1.1

This commit is contained in:
aurinex
2026-01-02 16:23:26 +05:00
parent d90ef2e535
commit a76a8b5656
3 changed files with 85 additions and 22 deletions

View File

@ -0,0 +1,30 @@
type VoiceState = {
connected: boolean;
participants: string[];
muted: boolean;
};
const state: VoiceState = {
connected: false,
participants: [],
muted: false,
};
const listeners = new Set<() => void>();
export function getVoiceState() {
return state;
}
export function setVoiceState(patch: Partial<VoiceState>) {
Object.assign(state, patch);
listeners.forEach((l) => l());
}
export function subscribeVoice(cb: () => void): () => void {
listeners.add(cb);
return () => {
listeners.delete(cb);
};
}