@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..
playaudio.hype.zip (500.0 KB)
Please feel free to post your own versions or better ways, I am sure there are..