From aa30a983854d6cb2d03bba837d56280bf35090eb Mon Sep 17 00:00:00 2001 From: BeritJanssen Date: Tue, 7 May 2024 11:49:18 +0200 Subject: [PATCH] fix: loop over all sections also for non-buffer loading --- frontend/src/components/Preload/Preload.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Preload/Preload.jsx b/frontend/src/components/Preload/Preload.jsx index ace85f153..5241469f9 100644 --- a/frontend/src/components/Preload/Preload.jsx +++ b/frontend/src/components/Preload/Preload.jsx @@ -54,12 +54,14 @@ const Preload = ({ sections, playMethod, duration, preloadMessage, pageTitle, on webAudio.closeWebAudio(); } // Load audio until available - // Return remove listener - return audio.loadUntilAvailable(section.url, () => { - if (index === (sections.length - 1)) { - setAudioAvailable(true); - } - }); + // Return remove listener + sections.forEach((section, index) => { + return audio.loadUntilAvailable(section.url, () => { + if (index === (sections.length - 1)) { + setAudioAvailable(true); + } + }); + }) } }