From 7cec21cff924b94cadc11091e664c390ab43f329 Mon Sep 17 00:00:00 2001 From: Angelo Reale <12191809+angeloreale@users.noreply.github.com> Date: Sun, 4 Aug 2024 19:58:49 +0100 Subject: [PATCH] ar(feat) DPCP-31: Audio Player --- src/molecules/02_AudioPlayer/AudioPlayer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/molecules/02_AudioPlayer/AudioPlayer.tsx b/src/molecules/02_AudioPlayer/AudioPlayer.tsx index a8f40f1..d1a6616 100644 --- a/src/molecules/02_AudioPlayer/AudioPlayer.tsx +++ b/src/molecules/02_AudioPlayer/AudioPlayer.tsx @@ -88,12 +88,13 @@ export const HAudioPlayer = function ({ const gridStyles = `${clsx(gridSx)} ${className}`; const handlePlay = () => { + if (!audioElement.current) return; onPlayTrack(); const isPlaying = status === 'playing'; if (isPlaying) { audioElement.current?.pause(); - if (audioElement.current) audioElement.current.currentTime = 0; + audioElement.current.currentTime = 0; setStatus('stopped'); } else { audioElement.current?.play();