I would like to create a various audio playlist (see pic) with Hype and I would like to use Howler.js for this. My main goal is to unload the audio when playing a new one (see this link)
This is great example, thank you. However I would like to play one audio at a time meaning "stop all sound when playing a new sound" (overlapping audio not allowed). Perhaps something like this
function newSong(url) {
if (sound != null) {
sound.stop();
sound.unload();
sound = null;
}
sound = new Howl({
src: [url]
});
sound.play();
}
There's probably a neater way of doing it as this gives me a function for each sound to play the sound and pause the others. It makes it very easy to change the sounds as I just have a list naming each as variable in the head html:
<script> var sound7 = new Howl({
src: ['${resourcesFolderName}/Willow.mp3']
});</script>
Then I added two functions to rewind or skip forward 15 seconds for the current sound playing. I also made sure none of the audio was preloading. With a lot of audio that can crash the browser.
It is probably not a good idea to post ChatGPT answers before you have tested they work as expected.
They often do not on first iterations and its answers give the impression they are correct way of doing things.
@faruk I think I agree with Mark here -- please give this a test and feel free to repost a Hype document if it works as you expect so it can help others accomplish their goals with Howler in Hype.