diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-08-07 23:25:14 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-08-07 23:25:14 +0100 |
| commit | a3f8976b38b37ecf0f61275de37ee7f241e3ad6f (patch) | |
| tree | dc72a61d256e0675c340dfd4b9fb6d3e462d7fda /static/scripts/spotify.js | |
| parent | 3a279aa6e9bd20dc1b51384b2cda088ad7b65131 (diff) | |
Clarify connection status on /spotify
Diffstat (limited to 'static/scripts/spotify.js')
| -rw-r--r-- | static/scripts/spotify.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/static/scripts/spotify.js b/static/scripts/spotify.js index 6a6aec6..8cecc09 100644 --- a/static/scripts/spotify.js +++ b/static/scripts/spotify.js @@ -64,6 +64,11 @@ const setOpenInSpotify = (songUrl) => { const connectWebsocket = () => { const connectionStatus = document.getElementById('connection-status-text'); const connectionStatusIndicator = document.getElementById('connection-status-indicator'); + const songTitle = document.getElementById('song-title'); + const songArtist = document.getElementById('song-artist'); + const songAlbum = document.getElementById('song-album'); + const songAlbumArt = document.getElementById('song-album-art'); + const onDisconnect = () => { connectionStatus.innerHTML = "Disconnected"; connectionStatusIndicator.style.backgroundColor = disconnectedColor; @@ -71,19 +76,17 @@ const connectWebsocket = () => { clearInterval(predictProgressInterval); } const onConnect = () => { - connectionStatus.innerHTML = "Connected"; - connectionStatusIndicator.style.backgroundColor = connectedColor; + connectionStatus.innerHTML = "Connected. Waiting for data..."; + connectionStatusIndicator.style.backgroundColor = connectingColor; } connectionStatus.innerHTML = "Connecting"; connectionStatusIndicator.style.backgroundColor = connectingColor; - const songTitle = document.getElementById('song-title'); - const songArtist = document.getElementById('song-artist'); - const songAlbum = document.getElementById('song-album'); - const songAlbumArt = document.getElementById('song-album-art'); - const updateData = (data) => { + connectionStatus.innerHTML = "Connected"; + connectionStatusIndicator.style.backgroundColor = connectedColor; + clearInterval(predictProgressInterval); progressMillis = data.progress; durationMillis = data.duration; |
