diff --git a/js/player.js b/js/player.js index 7832914..4bbd811 100644 --- a/js/player.js +++ b/js/player.js @@ -41,7 +41,7 @@ function playnew(pointer) { // Update the document title with the song and artist document.getElementById("length").textContent = sec2mins(Math.round(trk01.duration())); // Start the spectograph animation - specto(); + specto('on'); // Start upating the progress slider and playtime of the track. requestAnimationFrame(progress); }, @@ -81,10 +81,10 @@ function playnew(pointer) { document.title = "foam"; // update doc title back to default parent.pointer = 0; // reset our position in the queue back to the start trk01.unload(); // Unload the track from howler to free up mem - specto(); // Stop the spectograph animation + specto('off'); // Stop the spectograph animation } else { trk01.unload(); // Unload the track from howler to free up mem - specto(); // Stop the spectograph animation + specto('off'); // Stop the spectograph animation // We're not finished the queue yet so lets keep going playnew(pointer); // Call the playnew function again with our updated pointer } @@ -99,7 +99,7 @@ function playToggle() { parent.pause = true; trk01.pause(); // Pause the sound & show play button document.getElementById("playBtn").className = "bordered play icon"; - specto(); // Stop the spectograph animation + specto('off'); // Stop the spectograph animation } else { if (parent.pause === true) { parent.pause = false; @@ -140,8 +140,8 @@ function changeVol(newVol) { } // Start or stop the spectograph -function specto() { - if (document.getElementById("specto1").className == "spectrograph__off") { +function specto(state) { + if (state == 'on') { document.getElementById("specto1").className = "spectrograph__bar"; document.getElementById("specto2").className = "spectrograph__bar"; document.getElementById("specto3").className = "spectrograph__bar";