(e)
| 92 | |
| 93 | // Update Progress Bar & Time |
| 94 | function updateProgressBar(e) { |
| 95 | if (isPlaying) { |
| 96 | const { duration, currentTime } = e.srcElement; |
| 97 | // Update progress bar width |
| 98 | const progressPercent = (currentTime / duration) * 100; |
| 99 | progress.style.width = `${progressPercent}%`; |
| 100 | // Calculate display for duration |
| 101 | const durationMinutes = Math.floor(duration / 60); |
| 102 | let durationSeconds = Math.floor(duration % 60); |
| 103 | if (durationSeconds < 10) { |
| 104 | durationSeconds = `0${durationSeconds}`; |
| 105 | } |
| 106 | // Delay switching duration Element to avoid NaN |
| 107 | if (durationSeconds) { |
| 108 | durationEl.textContent = `${durationMinutes}:${durationSeconds}`; |
| 109 | } |
| 110 | // Calculate display for currentTime |
| 111 | const currentMinutes = Math.floor(currentTime / 60); |
| 112 | let currentSeconds = Math.floor(currentTime % 60); |
| 113 | if (currentSeconds < 10) { |
| 114 | currentSeconds = `0${currentSeconds}`; |
| 115 | } |
| 116 | currentTimeEl.textContent = `${currentMinutes}:${currentSeconds}`; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | // Set Progress Bar |
| 121 | function setProgressBar(e) { |
nothing calls this directly
no outgoing calls
no test coverage detected