enhanced overall Chat experience
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user