Skip to content

Commit

Permalink
Polished code and tested different timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Roi Saltzman committed Jun 20, 2022
1 parent abf6c6c commit 0ccd88b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/htmlMediaHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ import { Events } from 'jellyfin-apiclient';
}

function setCurrentTimeIfNeeded(element, seconds) {
if (Math.abs(element.currentTime || 0) - seconds <= 1) {
setTimeout(function(element, seconds){ element.currentTime = seconds; }, 500, element, seconds);
// If it's worth skipping (1 sec or less of a difference)
if (Math.abs((element.currentTime || 0) - seconds) <= 1) {
// Changing currentTime directly doesn't seek in the video
// A <=500 timeout doesn't seem to work for my setup
setTimeout(() => { element.currentTime = seconds; }, 500);
}
}

Expand Down

0 comments on commit 0ccd88b

Please sign in to comment.