Add 'm' and 'space' shortcuts for mute/unmuting during a call
This commit is contained in:
parent
6ef41b924d
commit
cb85733426
1 changed files with 33 additions and 2 deletions
|
@ -298,10 +298,14 @@ export function useGroupCall(groupCall: GroupCall): UseGroupCallReturnType {
|
||||||
PosthogAnalytics.instance.eventMuteCamera.track(toggleToMute);
|
PosthogAnalytics.instance.eventMuteCamera.track(toggleToMute);
|
||||||
}, [groupCall]);
|
}, [groupCall]);
|
||||||
|
|
||||||
|
const setMicrophoneMuted = useCallback((setMuted) => {
|
||||||
|
groupCall.setMicrophoneMuted(setMuted);
|
||||||
|
PosthogAnalytics.instance.eventMuteMicrophone.track(setMuted);
|
||||||
|
}, [groupCall]);
|
||||||
|
|
||||||
const toggleMicrophoneMuted = useCallback(() => {
|
const toggleMicrophoneMuted = useCallback(() => {
|
||||||
const toggleToMute = !groupCall.isMicrophoneMuted();
|
const toggleToMute = !groupCall.isMicrophoneMuted();
|
||||||
groupCall.setMicrophoneMuted(toggleToMute);
|
setMicrophoneMuted(toggleToMute);
|
||||||
PosthogAnalytics.instance.eventMuteMicrophone.track(toggleToMute);
|
|
||||||
}, [groupCall]);
|
}, [groupCall]);
|
||||||
|
|
||||||
const toggleScreensharing = useCallback(async () => {
|
const toggleScreensharing = useCallback(async () => {
|
||||||
|
@ -395,6 +399,33 @@ export function useGroupCall(groupCall: GroupCall): UseGroupCallReturnType {
|
||||||
}
|
}
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const keyDownListener = (event) => {
|
||||||
|
if (event.key === "m") {
|
||||||
|
toggleMicrophoneMuted();
|
||||||
|
}
|
||||||
|
if (event.key === " ") {
|
||||||
|
setMicrophoneMuted(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const keyUpListener = (event) => {
|
||||||
|
if (event.key === " ") {
|
||||||
|
setMicrophoneMuted(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("keydown", keyDownListener, true);
|
||||||
|
window.addEventListener("keyup", keyUpListener, true);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("keydown", keyDownListener, true);
|
||||||
|
window.removeEventListener("keyup", keyUpListener, true);
|
||||||
|
}
|
||||||
|
}, [toggleMicrophoneMuted, setMicrophoneMuted]);
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
state,
|
state,
|
||||||
calls,
|
calls,
|
||||||
|
|
Loading…
Add table
Reference in a new issue