Skip to content

Commit

Permalink
Added check for WebOS + clear timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Roi Saltzman committed Jun 23, 2022
1 parent a31588f commit 9a41959
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/htmlMediaHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,21 @@ import { Events } from 'jellyfin-apiclient';
return false;
}

let seek_timer;
function setCurrentTimeIfNeeded(element, seconds) {
// If it's worth skipping (1 sec or less of a difference)
// Check 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);
if (browser.web0s) {
// Changing currentTime directly doesn't seek the video in WebOS
// 500ms was chosen arbtrarily as it seems to work
clearTimeout(seek_timer);
seek_timer = setTimeout(() => {
seek_timer = null;
element.currentTime = seconds;
}, 500);
} else {
element.currentTime = seconds;
}
}
}

Expand Down

0 comments on commit 9a41959

Please sign in to comment.