Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Player - do not add Seek log when switching to new video
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
elpiel committed Nov 27, 2023
1 parent 61302b1 commit ec4ea13
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/models/player.rs
Original file line number Diff line number Diff line change
@@ -358,17 +358,7 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {
) => {
let seeking = library_item.state.time_offset.abs_diff(*time) > 1000;

// seek logging
if seeking
&& library_item.r#type == "series"
&& time < &PLAYER_IGNORE_SEEK_AFTER
{
self.seek_history.push(SeekLog {
from: library_item.state.time_offset,
to: *time,
});
}

// if we've selected a new video (like the next episode)
library_item.state.last_watched = Some(E::now());
if library_item.state.video_id != Some(video_id.to_owned()) {
library_item.state.video_id = Some(video_id.to_owned());
@@ -379,6 +369,18 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {
library_item.state.time_watched = 0;
library_item.state.flagged_watched = 0;
} else {
// else we have added to the currently selected video/stream
// seek logging
if seeking
&& library_item.r#type == "series"
&& time < &PLAYER_IGNORE_SEEK_AFTER
{
self.seek_history.push(SeekLog {
from: library_item.state.time_offset,
to: *time,
});
}

let time_watched =
1000.min(time.saturating_sub(library_item.state.time_offset));
library_item.state.time_watched =

0 comments on commit ec4ea13

Please sign in to comment.