Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Video 84 - Project 2 - Spotify Clone/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ async function main() {

// Listen for timeupdate event
currentSong.addEventListener("timeupdate", () => {
document.querySelector(".songtime").innerHTML = `${secondsToMinutesSeconds(currentSong.currentTime)} / ${secondsToMinutesSeconds(currentSong.duration)}`
document.querySelector(".circle").style.left = (currentSong.currentTime / currentSong.duration) * 100 + "%";
let timetake = secondsToMinutesSeconds(currentSong.currentTime)
let totaltime = secondsToMinutesSeconds(currentSong.duration)
document.querySelector(".songtime").innerHTML = timetake + ' / ' + totaltime;
document.querySelector(".circle").style.left = (currentSong.currentTime / currentSong.duration) * 100 + '%';
if (timetake == totaltime) {
play.src = "img/play.svg"
}
})

// Add an event listener to seekbar
Expand Down Expand Up @@ -210,4 +215,4 @@ async function main() {

}

main()
main()