diff --git a/src/room/PTTButton.tsx b/src/room/PTTButton.tsx index 53f6f7b..306a331 100644 --- a/src/room/PTTButton.tsx +++ b/src/room/PTTButton.tsx @@ -57,13 +57,17 @@ export const PTTButton: React.FC = ({ const buttonRef = useRef(); const [activeTouchId, setActiveTouchId] = useState(null); + const [buttonHeld, setButtonHeld] = useState(false); const hold = useCallback(() => { // This update is delayed so the user only sees it if latency is significant + if (buttonHeld) return; + setButtonHeld(true); enqueueNetworkWaiting(true, 100); startTalking(); - }, [enqueueNetworkWaiting, startTalking]); + }, [enqueueNetworkWaiting, startTalking, buttonHeld]); const unhold = useCallback(() => { + setButtonHeld(false); setNetworkWaiting(false); stopTalking(); }, [setNetworkWaiting, stopTalking]);