mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
perfomance instead of date
This commit is contained in:
@@ -533,10 +533,10 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||||||
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);
|
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);
|
||||||
if (delayTime < 300 && utils.isFirefox()) {
|
if (delayTime < 300 && utils.isFirefox()) {
|
||||||
// For Firefox, use interval instead of timeout near the end to combat imprecise video time
|
// For Firefox, use interval instead of timeout near the end to combat imprecise video time
|
||||||
const startIntervalTime = Date.now();
|
const startIntervalTime = performance.now();
|
||||||
const startVideoTime = video.currentTime;
|
const startVideoTime = video.currentTime;
|
||||||
currentSkipInterval = setInterval(() => {
|
currentSkipInterval = setInterval(() => {
|
||||||
const intervalDuration = Date.now() - startIntervalTime;
|
const intervalDuration = performance.now() - startIntervalTime;
|
||||||
console.log(startVideoTime + intervalDuration / 1000)
|
console.log(startVideoTime + intervalDuration / 1000)
|
||||||
if (intervalDuration >= delayTime) {
|
if (intervalDuration >= delayTime) {
|
||||||
clearInterval(currentSkipInterval);
|
clearInterval(currentSkipInterval);
|
||||||
|
|||||||
Reference in New Issue
Block a user