From ce362f56355419d35b6223982ffabb663453d63b Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 21 Feb 2026 23:23:56 -0600 Subject: [PATCH] feat(qconnect): relay local player state changes to QConnect server When QBZ is acting as a QConnect renderer, local user interactions (volume change, play/pause) are now reported back to the server via v2_qconnect_report_volume and v2_qconnect_report_playback_state. This keeps the controller in sync with QBZ's actual state. --- src/routes/+page.svelte | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2781f5fbe..74d4d327b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1691,6 +1691,10 @@ function handleVolumeChange(newVolume: number) { playerSetVolume(newVolume); + // Report volume change to QConnect server when acting as renderer + if (isQobuzConnectConnected) { + invoke('v2_qconnect_report_volume', { volume: newVolume }).catch(() => {}); + } } async function toggleShuffle() { @@ -3321,6 +3325,23 @@ debouncedFullSessionSave(); } + // QConnect renderer state relay: report local state changes to server + if (isQobuzConnectConnected) { + const playingState = isPlaying ? 2 : (currentTrack ? 3 : 1); + const positionMs = Math.round((currentTime || 0) * 1000); + const durationMs = Math.round((playerState.duration || 0) * 1000); + // Only report on meaningful state transitions (play/pause change or track change) + if (wasPlaying !== isPlaying || (currentTrack?.id ?? 0) !== (prevTrackId ?? 0)) { + invoke('v2_qconnect_report_playback_state', { + playingState: playingState, + currentPosition: positionMs, + duration: durationMs, + currentQueueItemId: null, + nextQueueItemId: null, + }).catch(() => {}); + } + } + // MiniPlayer IPC - DISABLED: incomplete feature, causes unnecessary IPC overhead // if (currentTrack) { // emitTo('miniplayer', 'miniplayer:track', {