Requested example of Autoplay Audio tracks in sequence

@felipxbr wanted to know how to have some tracks play in sequence from a track list.

This is a quick and dirty example of one way to have Audio tracks play each track in sequence.

This example uses a simple array as the track list.
We use two global vars to work out which track to play.
1, is the length of the track array.
2, is the track number.

We simply compare the current track play number with the count of tracks. Then increase the number if it is not greater than the tracks count.

This give us the next track number to play. ( Array number start at 0, so track one is 0 track two is 1 so we alway deduct 1 from the length of the track array)

We have the first track to play, hard coded as 0.
So when we hit the start button the track 0 will play.
We have a addEventListener that listens to when playing has ended. This will trigger the track number to play to increase by 1 and call the function that will play the next track.

All very simple… (500.0 KB)

Please feel free to post your own versions or better ways, I am sure there are…

1 Like

Thank you for it!
In this example how put a simple progress bar ?

thanks again!


What do you mean by simple.

I tried merge this project below ( progress bar with draggable only )
with your example but I can not:

my goal is something like this:

Please, you can show a way?


Working with some one else code can always be a challenge.

I have added my code to the other. ( was not simple due to above statement ) but I think I have it as simplified as I can get it with both sets of code mashed together and without re writing and laying out a new Hype project. (1.1 MB)

Thank you very much!

1 Like

Works flawlessly!


Please, how do put this playlist in html page with links for random choosing?


Can you explain that a bit better of what you mean.

Sorry my bad English . I just need to place the links to choose which song to start playing .

Please, any idea?

Not really,

You did not elaborate on what you wanted. You already have the tracks auto play and in sequence.
So how are you expecting the a playlist to work.

Also what do you have that you have tried so far…