Skip to content

Commit

Permalink
fix: change audio functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MariyaShusharina committed Sep 22, 2024
1 parent 2780fd8 commit 19a8d53
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function nextSong() {
audio.src = playlist[numSong];
isPlay = true;
playBtn.classList.add("pause");
audio.currentTime = 0;
audio.play();
} else {
audio.pause();
Expand Down Expand Up @@ -142,9 +143,10 @@ function prevSong() {

if (isPlay === false) {
audio.src = playlist[numSong];
audio.play();
isPlay = true;
playBtn.classList.add("pause");
audio.currentTime = 0;
audio.play();
} else {
audio.pause();
audio.src = playlist[numSong];
Expand All @@ -164,6 +166,8 @@ function prevSong() {

function songTimeChange(value) {

songMaxTime = Math.round(audio.duration);

audio.currentTime = Math.round((songMaxTime / 100) * value);

songTime = audio.currentTime;
Expand Down

0 comments on commit 19a8d53

Please sign in to comment.