webmusic.js: renamed gstate to playerState

This commit is contained in:
Leah 2021-03-07 15:22:50 +01:00
parent edd16ecb24
commit cef0e6b625
1 changed files with 4 additions and 4 deletions

View File

@ -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);