« 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 <towerofnix@gmail.com>2021-03-15 21:29:48 -0300
commit53de9a079bcc91012be72518b58e5621019b3697 (patch)
tree7e4afe2585349f89f15260158e5ab9b27ef819e5
parentf46056bca47ec9373888a154209861acb6140e5a (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 fec66d7..284c767 100644
--- a/socket.js
+++ b/socket.js
@@ -283,6 +283,8 @@ 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',