From 326efae7a9c6a47b65c5242ba4f4c16c332ab2bd Mon Sep 17 00:00:00 2001 From: Nick Dowsett Date: Thu, 30 Nov 2023 22:43:07 +0800 Subject: [PATCH] Fixed incorrect play behaviour when paused. Resolves #4 --- src/app/server/player.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/server/player.rs b/src/app/server/player.rs index 3bc74f15..12719cc0 100644 --- a/src/app/server/player.rs +++ b/src/app/server/player.rs @@ -104,7 +104,16 @@ pub fn spawn_rodio_thread( sink.stop() } sink.append(source); + // Handle case we're we've received a play message but queue was paused. + if sink.is_paused() { + sink.play(); + } debug!("Now playing {:?}", id); + // Send the Now Playing message for good orders sake to avoid synchronization issues. + blocking_send_or_error( + &response_tx, + super::Response::Player(Response::Playing(song_id, id)), + ); cur_song_elapsed = Duration::default(); cur_song_id = song_id; thinks_is_playing = true;