From 99c990b790a5081cffe02caca76f74dd647dede2 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Mon, 18 Nov 2024 12:04:31 +0200 Subject: [PATCH] fix(stremio-core-web): Player - video progress should be set only on current video Signed-off-by: Lachezar Lechev --- .../src/model/serialize_player.rs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/stremio-core-web/src/model/serialize_player.rs b/stremio-core-web/src/model/serialize_player.rs index 325e9362d..b6326ca5d 100644 --- a/stremio-core-web/src/model/serialize_player.rs +++ b/stremio-core-web/src/model/serialize_player.rs @@ -156,11 +156,23 @@ pub fn serialize_player( .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,