Skip to content

Commit

Permalink
fix: loop over all sections also for non-buffer loading
Browse files Browse the repository at this point in the history
  • Loading branch information
BeritJanssen committed May 7, 2024
1 parent 139771d commit aa30a98
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions frontend/src/components/Preload/Preload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
})
}
}

Expand Down

0 comments on commit aa30a98

Please sign in to comment.