Skip to content

Commit

Permalink
refacto(player): update next_video streams with next_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Oct 13, 2023
1 parent a59348f commit 27e9bf4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/models/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {
};
let next_video_effects = next_video_update(
&mut self.next_video,
&self.next_stream,
&self.selected,
&self.meta_item,
&ctx.profile.settings,
Expand Down Expand Up @@ -490,6 +491,7 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {

let next_video_effects = next_video_update(
&mut self.next_video,
&self.next_stream,
&self.selected,
&self.meta_item,
&ctx.profile.settings,
Expand Down Expand Up @@ -586,6 +588,7 @@ fn switch_to_next_video(

fn next_video_update(
video: &mut Option<Video>,
stream: &Option<Stream>,
selected: &Option<Selected>,
meta_item: &Option<ResourceLoadable<MetaItem>>,
settings: &ProfileSettings,
Expand Down Expand Up @@ -627,8 +630,13 @@ fn next_video_update(
.unwrap_or_default();
next_season != 0 || current_season == next_season
})
.map(|(_, next_video)| next_video)
.cloned(),
.map(|(_, next_video)| {
let mut next_video = next_video.clone();
if let Some(stream) = stream {
next_video.streams = vec![stream.clone()];
}
next_video
}),
_ => None,
};
eq_update(video, next_video)
Expand Down

0 comments on commit 27e9bf4

Please sign in to comment.