« get me outta code hell

resume canonical player when all sockets are ready - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-15 21:29:48 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 19:13:42 -0300
commit9577f46b1ed6c205f938e5e6a9cba9bdaa20f500 (patch)
treed60c38cc7d44e89859fdac10253a690950f5c564
parent8c1ca578d12c905ff5a7bf1fe1ac752e645e5dd7 (diff)
resume canonical player when all sockets are ready
this fixes an issue where a sync-playback received immediately during
the resume would receive the paused status!

in general, the canonical backend should always stay in line with the
messages that the server sends out.
-rw-r--r--socket.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/socket.js b/socket.js
index 52a2d51..5d4f85a 100644
--- a/socket.js
+++ b/socket.js
@@ -283,6 +283,8 @@ export function makeSocketServer() {
             if (readySockets && !readySockets.includes(socket)) {
               readySockets.push(socket)
               if (readySockets.length === sockets.length) {
+                const QP = server.canonicalBackend.queuePlayers.find(QP => QP.id === command.queuePlayer)
+                silenceEvents(QP, ['set-pause'], () => QP.setPause(false))
                 for (const socket of sockets) {
                   socket.write(serializeCommandToData({
                     sender: 'server',