Skip to content

Commit

Permalink
Player: Fix video playback for videos that have already been watched.
Browse files Browse the repository at this point in the history
Trying to watch an already watched video will make the video start 15
seconds before the end of the video. This is not very comfortable when
listening to music or watching/listening playlists over and over.
  • Loading branch information
Fijxu committed Jun 15, 2024
1 parent 1ae14cc commit e82c965
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,12 @@ if (video_data.params.save_player_pos) {
const rememberedTime = get_video_time();
let lastUpdated = 0;

if(!hasTimeParam) set_seconds_after_start(rememberedTime);
if(!hasTimeParam) {
if (rememberedTime >= video_data.length_seconds - 20)
set_seconds_after_start(0);
else
set_seconds_after_start(rememberedTime);
}

player.on('timeupdate', function () {
const raw = player.currentTime();
Expand Down

0 comments on commit e82c965

Please # to comment.