Tell us what’s happening:
Sorry, your code does not pass. Hang in there.
Your playSong function should set the currentTime property of the audio object to 0 when no current song is playing.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function playSong(songId) {
const song = userData.songs.find(s => s.id === songId);
if (song) {
// Reset playback time only if no song is currently playing
if (!userData.currentSong) {
audio.currentTime = 0;
}
userData.currentSong = song;
userData.songCurrentTime = 0;
audio.src = song.src;
audio.title = song.title;
audio.play();
}
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0
Challenge Information:
Build a Music Player - Step 13
https://www.freecodecamp.org/learn/full-stack-developer/workshop-music-player/step-13
