From 7db7bbe4ead6a609ac1a58905b80b3879904ee7a Mon Sep 17 00:00:00 2001 From: malmen237 Date: Tue, 30 Apr 2024 09:48:30 +0200 Subject: [PATCH] fix: updated audio-cue-hook --- .../production-line/use-audio-cue.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/production-line/use-audio-cue.ts b/src/components/production-line/use-audio-cue.ts index 8c0215b5..e3c24367 100644 --- a/src/components/production-line/use-audio-cue.ts +++ b/src/components/production-line/use-audio-cue.ts @@ -4,24 +4,24 @@ import connectionStart from "../../assets/sounds/start-connection.mp3"; import connectionStop from "../../assets/sounds/stop-connection.mp3"; export const useAudioCue = () => { - const onEnterNotificationSound = useMemo(() => { + const playEnterSound = useMemo(() => { const audio = new Audio(connectionStart); audio.load(); - return audio; + return () => { + audio.play(); + }; }, []); - const onExitNotificationSound = useMemo(() => { + const playExitSound = useMemo(() => { const audio = new Audio(connectionStop); audio.load(); - return audio; + return () => { + audio.play(); + }; }, []); return { - playEnterSound: () => { - onEnterNotificationSound.play(); - }, - playExitSound: () => { - onExitNotificationSound.play(); - }, + playEnterSound, + playExitSound, }; };