summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-07 15:22:50 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-07 15:22:50 +0100
commitfd0af3fa27d02f0b6084188864491a7aa41850db (patch)
tree05955d5af88c7bcfc7ba75b99dafb3f07d5809c6
parentb246cd3ff4d02e8e26fe2b9c12f95fa54336cc9b (diff)
downloadwebmusic-nginx-fd0af3fa27d02f0b6084188864491a7aa41850db.tar.gz
webmusic-nginx-fd0af3fa27d02f0b6084188864491a7aa41850db.tar.bz2
webmusic-nginx-fd0af3fa27d02f0b6084188864491a7aa41850db.zip
webmusic.js: renamed gstate to playerState
-rw-r--r--webmusic.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/webmusic.js b/webmusic.js
index 7f95891..87fe032 100644
--- a/webmusic.js
+++ b/webmusic.js
@@ -1,7 +1,7 @@
let audioPlayer = new Audio();
+let playerState = "idle";
let continuous = true;
let repeat = false;
-let gstate = "idle";
let total = 0;
let index = 0;
@@ -9,7 +9,7 @@ const handleKeyEvent = (event) => {
switch (event.key) {
case " ":
case "p":
- if (gstate == "idle" && total !== 0) {
+ if (playerState == "idle" && total !== 0) {
if (document.getElementById(index).classList.contains('dir')) {
return nextTrack();
}
@@ -83,14 +83,14 @@ const initState = () => {
}
const setPlayerState = (state) => {
- gstate = state;
+ playerState = state;
console.log("now in state: " + state);
updatePlayerState();
}
const updatePlayerState = () => {
- let statestr = "[" + gstate;
+ let statestr = "[" + playerState;
if (!audioPlayer.paused) {
statestr += " " + formatTime(audioPlayer.currentTime) + "/" + formatTime(audioPlayer.duration);