Skip to content

Commit

Permalink
fix(stremio-core-web): Player - video progress should be set only on …
Browse files Browse the repository at this point in the history
…current video

Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Nov 18, 2024
1 parent 62a08ba commit 99c990b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions stremio-core-web/src/model/serialize_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,23 @@ pub fn serialize_player<E: stremio_core::runtime::Env + 'static>(
.unwrap_or_default(),
// only the currently playing video can have the progress
// as we keep that information in the LibraryItem
progress: ctx
.library
.items
.get(&meta_item.preview.id)
.map(|library_item| library_item.progress()),
progress: ctx.library.items.get(&meta_item.preview.id).and_then(
|library_item| {
// only set up the progress for the current video
// for series, the selected stream path ID should be the video id!
if player
.selected
.as_ref()
.and_then(|selected| selected.stream_request.as_ref())
.map(|stream_request| stream_request.path.id == video.id)
.unwrap_or_default()
{
Some(library_item.progress())
} else {
None
}
},
),
scheduled: meta_item.preview.behavior_hints.has_scheduled_videos,
deep_links: VideoDeepLinks::from((
video,
Expand Down

0 comments on commit 99c990b

Please sign in to comment.