Skip to content

Commit

Permalink
ar(feat) DPCP-31: Audio Player
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Aug 4, 2024
1 parent d20bc56 commit 7cec21c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/molecules/02_AudioPlayer/AudioPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7cec21c

Please sign in to comment.