diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 20:53:12 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 20:54:08 +0200 |
| commit | 2a16dcba5a31a45a12853a15254719c357baae6d (patch) | |
| tree | 92271c8ce54846e684cd874c8c2008651c3a9778 /web | |
| parent | d8bdce51c336f3693121202402ee38ff3f12c0e2 (diff) | |
| download | WRMS-2a16dcba5a31a45a12853a15254719c357baae6d.tar.gz WRMS-2a16dcba5a31a45a12853a15254719c357baae6d.zip | |
use an atomic pointer to track the current song
Also fix showing finished songs as current playing on new
clients.
Diffstat (limited to 'web')
| -rw-r--r-- | web/client.html | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/client.html b/web/client.html index 91ce11d..c0aef1f 100644 --- a/web/client.html +++ b/web/client.html @@ -202,9 +202,15 @@ playing = document.getElementById("playing").innerHTML = ""; } - function handlePlay(currentSong) { + function handlePlay(_currentSongs) { {{if .IsAdmin}} document.getElementById("ppbutton").innerHTML = 'Pause'; {{end}} + if (_currentSongs == null || _currentSongs.length == 0) { + return; + } + + const currentSong = _currentSongs[0] + idx = -1; songs.forEach(function(s, i, a) { if (s.uri == currentSong.uri) idx = i; }); if (idx != -1) { @@ -251,7 +257,7 @@ handleStop() break; case "play": - handlePlay(cmd.songs[0]) + handlePlay(cmd.songs) break; case "upvoted": handleVotes("up", cmd.songs) |
