Untitled
unknown
javascript
3 years ago
872 B
12
Indexable
function loadTrack(track_index) { // Clear the previous seek timer clearInterval(updateTimer); resetValues(); // Load a new track curr_track.src = track_list[track_index].path; curr_track.load(); // Update details of the track track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; track_name.textContent = track_list[track_index].name; track_artist.textContent = track_list[track_index].artist; now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; // Set an interval of 1000 milliseconds // for updating the seek slider updateTimer = setInterval(seekUpdate, 1000); // Move to the next track if the current finishes playing // using the 'ended' event curr_track.addEventListener("ended", nextTrack); // Apply a random background color random_bg_color(); }
Editor is loading...