diff --git a/crates/qbz-slint/src/playback.rs b/crates/qbz-slint/src/playback.rs index 12a5a06e1..813c27234 100644 --- a/crates/qbz-slint/src/playback.rs +++ b/crates/qbz-slint/src/playback.rs @@ -2033,6 +2033,13 @@ pub fn start_poll_loop( let elapsed = fmt_elapsed(position_secs); let remaining = fmt_remaining(position_secs, duration_secs); let playing = remote.playing; + // Reflect the PEER's actual volume on the bar so a drag starts + // from a safe level (never QBZ's local 100). When the peer hasn't + // reported a volume, clamp to 50% — the AVR-nuke safety default. + let remote_volume = remote + .volume + .map(|v| (v as f32 / 100.0).clamp(0.0, 1.0)) + .unwrap_or(0.5); let _ = weak.upgrade_in_event_loop(move |w| { let np = w.global::(); np.set_position_secs(position_secs as i32); @@ -2044,6 +2051,7 @@ pub fn start_poll_loop( np.set_elapsed(elapsed.into()); np.set_remaining(remaining.into()); np.set_playing(playing); + np.set_volume(remote_volume); }); // Reset the LOCAL edge trackers so when control returns to QBZ // the end-of-track / gapless / transition logic re-detects from a diff --git a/crates/qbz-slint/src/qconnect_service.rs b/crates/qbz-slint/src/qconnect_service.rs index fa1775b07..54027a7b9 100644 --- a/crates/qbz-slint/src/qconnect_service.rs +++ b/crates/qbz-slint/src/qconnect_service.rs @@ -72,6 +72,10 @@ pub struct RemoteNowPlaying { pub position_ms: u64, pub updated_at_ms: u64, pub playing: bool, + /// Peer renderer's reported volume (0..=100). `None` when the peer hasn't + /// reported a volume yet — the bar then clamps to a safe 50% instead of + /// reflecting QBZ's local 100, so a drag never nukes the AVR. + pub volume: Option, } /// Process-wide QConnect service singleton (one per app, like the playback @@ -803,6 +807,7 @@ impl SlintQconnectService { position_ms: renderer.current_position_ms.unwrap_or(0), updated_at_ms: renderer.updated_at_ms, playing: renderer.playing_state == Some(PLAYING_STATE_PLAYING), + volume: renderer.volume, }) }