How to make switching songs?

Please help! I want to implement the switching of songs is not obtained somehow
here is the code
const audio = document.getElementById('audio');
const track = document.getElementsByTagName('li');
const time = document.getElementById('time');
const duration = document.getElementById('duration');
const progress_bar = document.getElementById("value");
const audio_bar = document.getElementById("progress");

window.setInterval(function(){
updateProgressBar();
}, 100);

var play = 0;

for (i = 0;i < track.length; i++) {
 track[i].onclick = function () {
 audio.src = this.getAttribute("data-src");
audio.play();
 play = 1;
 document.querySelector('.player').style.display = "block";
 document.getElementById("play").innerHTML = '<i class="material-icons">pause</i>';
}
}

// next song
for (i = 0;i < track.length; i++) {
 document.getElementById("next").onclick = function () {
 audio.src = this.getAttribute("data-src");
}
}

Help please((
April 3rd 20 at 18:56
0 answer

Find more questions by tags JavaScript