enhanced overall Chat experience

This commit is contained in:
PxlLoewe
2025-06-09 22:38:31 -07:00
parent ea78b41510
commit b4b7b4def2
7 changed files with 119 additions and 98 deletions

View File

@@ -46,7 +46,7 @@ export const useAudioStore = create<TalkState>((set, get) => ({
micDeviceId: null,
speakingParticipants: [],
micVolume: 1,
state: "disconnected",
state: "disconnected" as const,
remoteParticipants: 0,
connectionQuality: ConnectionQuality.Unknown,
room: null,
@@ -77,16 +77,23 @@ export const useAudioStore = create<TalkState>((set, get) => ({
set({ micDeviceId, micVolume });
},
toggleTalking: () => {
const { room, isTalking, micDeviceId, micVolume, speakingParticipants } = get();
const { room, isTalking, micDeviceId, micVolume, speakingParticipants, transmitBlocked } =
get();
if (!room) return;
if (speakingParticipants.length > 0 && !isTalking) {
if (speakingParticipants.length > 0 && !isTalking && !transmitBlocked) {
// Wenn andere sprechen, nicht reden
set({
message: "Rufgruppe besetzt",
transmitBlocked: true,
});
return;
} else if (!isTalking && transmitBlocked) {
set({
message: null,
transmitBlocked: false,
});
return;
}
// Todo: use micVolume
room.localParticipant.setMicrophoneEnabled(!isTalking, {