Skip to content

Commit ffd8680

Browse files
allisonallison
authored andcommitted
fix(playback): synchronize UI playback state with engine on session restore (#371)
## Summary codeberg ate my damn commit in #370 ## Changes <!-- What specific changes were made? --> ## Testing <!-- How did you test these changes? --> ## Checklist - [ ] No new warnings or clippy lints introduced - if so, explain why - [ ] Code works on all supported platforms (Linux, macOS, Windows) - tested on available platforms - [ ] Documentation added/updated where needed - [ ] If using generative AI assistance, disclosure is provided (co-authored-by tag or PR description) - see [here](CONTRIBUTING.md) Reviewed-on: https://codeberg.org/hummingbird/hummingbird/pulls/371
1 parent a356805 commit ffd8680

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/ui/models.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,12 @@ pub fn build_models(
540540

541541
let position: Entity<u64> = cx.new(|_| 0);
542542
let duration: Entity<u64> = cx.new(|_| 0);
543-
let playback_state: Entity<PlaybackState> = cx.new(|_| PlaybackState::Stopped);
543+
let default_playback_state = if initial_track.is_some() {
544+
PlaybackState::Paused
545+
} else {
546+
PlaybackState::Stopped
547+
};
548+
let playback_state: Entity<PlaybackState> = cx.new(|_| default_playback_state);
544549
let current_track: Entity<Option<CurrentTrack>> = cx.new(|_| initial_track);
545550
let shuffling: Entity<bool> = cx.new(|_| initial_shuffle);
546551
let repeating: Entity<RepeatState> = cx.new(|_| initial_repeat);

0 commit comments

Comments
 (0)