mirror of
https://github.com/Dummi26/musicdb.git
synced 2025-03-10 05:43:53 +01:00
fixed bugs with playback when paused
This commit is contained in:
parent
f625233a1b
commit
55590a1549
@ -82,8 +82,6 @@ impl Player {
|
||||
// db.playing, but no song in queue...
|
||||
db.apply_command(Command::Stop);
|
||||
}
|
||||
} else if !db.playing && self.source.is_some() {
|
||||
self.current_song_id = SongOpt::New(None);
|
||||
} else if let Some((_source, notif)) = &mut self.source {
|
||||
if let Ok(()) = notif.try_recv() {
|
||||
// song has finished playing
|
||||
@ -121,10 +119,12 @@ impl Player {
|
||||
Some(s) => s.to_str().unwrap_or(""),
|
||||
None => "",
|
||||
};
|
||||
if db.playing {
|
||||
if let Some(bytes) = song.cached_data_now(db) {
|
||||
match Self::sound_from_bytes(ext, bytes) {
|
||||
Ok(v) => {
|
||||
let (sound, notif) = v.pausable().with_async_completion_notifier();
|
||||
let (sound, notif) =
|
||||
v.pausable().with_async_completion_notifier();
|
||||
// add it
|
||||
let (sound, controller) = sound.controllable();
|
||||
self.source = Some((controller, notif));
|
||||
@ -137,6 +137,10 @@ impl Player {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.source = None;
|
||||
song.cache_data_start_thread(&db);
|
||||
}
|
||||
} else {
|
||||
panic!("invalid song ID: current_song_id not found in DB!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user