From 35b9a524b23004ec79ee48b647e936a057177076 Mon Sep 17 00:00:00 2001 From: Timo K Date: Fri, 12 Sep 2025 14:21:31 +0200 Subject: [PATCH] overlay styling and interval fixes Signed-off-by: Timo K --- src/room/InCallView.tsx | 31 +++++++++++++----------------- src/room/WaitingForJoin.module.css | 2 -- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 3d228104..c7e7acf1 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -50,6 +50,7 @@ import { type HeaderStyle, useUrlParams } from "../UrlParams"; import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts"; import { ElementWidgetActions, widget } from "../widget"; import styles from "./InCallView.module.css"; +import overlayStyles from "../Overlay.module.css"; import { GridTile } from "../tile/GridTile"; import { type OTelGroupCallMembership } from "../otel/OTelGroupCallMembership"; import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal"; @@ -285,6 +286,8 @@ export const InCallView: FC = ({ // do we want a timeout sound? }); }); + // configure this to sth that fits to the pickup waiting sound. + const PICKUP_SOUND_INTERVAL = 1000; const pickupPhaseAudio = useAudioContext({ sounds: pickupPhaseSoundCache, @@ -360,6 +363,7 @@ export const InCallView: FC = ({ onLeave(); } if (callPickupState === "decline") { + // Wait for the sound to finish before leaving void pickupPhaseAudio ?.playSound("decline") .catch((e) => { @@ -372,23 +376,12 @@ export const InCallView: FC = ({ }); // When waiting for pickup, loop a waiting sound - const [playing, setPlaying] = useState(false); useEffect((): void | (() => void) => { - if (callPickupState !== "ringing") return; - setPlaying(true); - // play and then wait for 1.5s - const playSoundAndWait = async (): Promise => { - await pickupPhaseAudio?.playSound("waiting"); - await new Promise((res) => setTimeout(res, 1500)); - }; - const startPlaying = async (): Promise => { - while (playing) { - await playSoundAndWait(); - } - }; - void startPlaying(); - return (): void => setPlaying(false); - }, [callPickupState, pickupPhaseAudio, playing]); + const interval = window.setInterval(() => { + void pickupPhaseAudio?.playSound("waiting"); + }, PICKUP_SOUND_INTERVAL); + return (): void => window.clearInterval(interval); + }, [callPickupState, pickupPhaseAudio]); // Waiting UI overlay const waitingOverlay: JSX.Element | null = useMemo(() => { @@ -413,8 +406,10 @@ export const InCallView: FC = ({ : (matrixRoom.getMxcAvatarUrl() ?? undefined); return ( -
-
+
+