From 0c920da9fc6e44e8b6c00afceb3496e44e7d70f9 Mon Sep 17 00:00:00 2001 From: Angelo Reale <12191809+angeloreale@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:01:42 +0100 Subject: [PATCH 1/2] ar(fix) [DPCP-45]: Audio Player live stream buffer --- src/molecules/02_AudioPlayer/AudioPlayer.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/molecules/02_AudioPlayer/AudioPlayer.tsx b/src/molecules/02_AudioPlayer/AudioPlayer.tsx index bcd313d..c41f72b 100644 --- a/src/molecules/02_AudioPlayer/AudioPlayer.tsx +++ b/src/molecules/02_AudioPlayer/AudioPlayer.tsx @@ -89,11 +89,14 @@ export const HAudioPlayer = function ({ const isPlaying = status === 'playing'; if (isPlaying) { - audioElement.current?.pause(); - audioElement.current.currentTime = 0; + audioElement.current.pause(); + audioElement.current.src = 'about:blank'; + audioElement.current.load(); setStatus('stopped'); } else { - audioElement.current?.play(); + audioElement.current.src = tracks[0].url; + audioElement.current.load(); + audioElement.current.play(); setStatus('playing'); } }; From 255e77d7aa5c73269799349cfc5900a9846d28f3 Mon Sep 17 00:00:00 2001 From: Angelo Reale <12191809+angeloreale@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:08:24 +0100 Subject: [PATCH 2/2] ar(fix) [DPCP-45]: Audio Player live stream buffer --- src/molecules/02_AudioPlayer/AudioPlayer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/molecules/02_AudioPlayer/AudioPlayer.tsx b/src/molecules/02_AudioPlayer/AudioPlayer.tsx index c41f72b..2eaafc6 100644 --- a/src/molecules/02_AudioPlayer/AudioPlayer.tsx +++ b/src/molecules/02_AudioPlayer/AudioPlayer.tsx @@ -94,7 +94,7 @@ export const HAudioPlayer = function ({ audioElement.current.load(); setStatus('stopped'); } else { - audioElement.current.src = tracks[0].url; + audioElement.current.src = tracks[0].url || 'about:blank'; audioElement.current.load(); audioElement.current.play(); setStatus('playing');