Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions crates/state/src/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,19 +541,22 @@ impl Playback {
/// Loads a track to play from `at`, after the debounce `start` asks for. The state reads
/// Loading from here until the engine reports audio; a refusal or an unplayable track fails
/// without reaching the engine.
fn load_from(&mut self, track: &Track, at: Duration, start: Start, cx: &mut Context<Self>) {
match self.refused {
Some(Refusal::Keys) => return self.refuse(cx),
Some(Refusal::SignIn) => return self.gate(cx),
None => {}
}
fn load_from(&mut self, track: &Track, at: Duration, start: Start, cx: &mut Context<Self>) {
let Some(id) = track.id.clone() else {
return self.failed(format!("{} has no track id", track.name), cx);
};
let is_local = music::is_local_id(&id);
if !is_local {
match self.refused {
Some(Refusal::Keys) => return self.refuse(cx),
Some(Refusal::SignIn) => return self.gate(cx),
None => {}
}
}
if !track.playable {
return self.failed(format!("{} is not available to stream", track.name), cx);
}
if !music::is_local_id(&id) && Network::lost(cx) {
if !is_local && Network::lost(cx) {
return self.unreachable(start, cx);
}
if self.engine_for(&id).is_none() {
Expand Down Expand Up @@ -2310,4 +2313,4 @@ mod tests {
previous = sample;
}
}
}
}
Loading