Skip to content

Commit

Permalink
fix: updated audio-cue-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Apr 30, 2024
1 parent 9d37c9c commit 7db7bbe
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/production-line/use-audio-cue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};

0 comments on commit 7db7bbe

Please sign in to comment.