mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 09:58:45 -04:00
CPU usage fix since nudging didn't stop properly
This commit is contained in:
11
inject.js
11
inject.js
@@ -249,6 +249,7 @@ function defineVideoController() {
|
|||||||
}
|
}
|
||||||
} else if (event.type === "pause" || event.type === "ended") {
|
} else if (event.type === "pause" || event.type === "ended") {
|
||||||
this.stopSubtitleNudge();
|
this.stopSubtitleNudge();
|
||||||
|
tc.isNudging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For seek events, don't mess with speed
|
// For seek events, don't mess with speed
|
||||||
@@ -369,17 +370,27 @@ function defineVideoController() {
|
|||||||
this.stopSubtitleNudge();
|
this.stopSubtitleNudge();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Additional check to not start if paused
|
||||||
|
if (this.video.paused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
log(`Nudge: Starting interval: ${tc.settings.subtitleNudgeInterval}ms.`, 5);
|
log(`Nudge: Starting interval: ${tc.settings.subtitleNudgeInterval}ms.`, 5);
|
||||||
this.nudgeIntervalId = setInterval(() => {
|
this.nudgeIntervalId = setInterval(() => {
|
||||||
if (
|
if (
|
||||||
!this.video ||
|
!this.video ||
|
||||||
this.video.paused ||
|
this.video.paused ||
|
||||||
|
this.video.ended ||
|
||||||
this.video.playbackRate === 1.0 ||
|
this.video.playbackRate === 1.0 ||
|
||||||
tc.isNudging
|
tc.isNudging
|
||||||
) {
|
) {
|
||||||
this.stopSubtitleNudge();
|
this.stopSubtitleNudge();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Double-check pause state before nudging
|
||||||
|
if (this.video.paused) {
|
||||||
|
this.stopSubtitleNudge();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const currentRate = this.video.playbackRate;
|
const currentRate = this.video.playbackRate;
|
||||||
const nudgeAmount = tc.settings.subtitleNudgeAmount;
|
const nudgeAmount = tc.settings.subtitleNudgeAmount;
|
||||||
tc.isNudging = true;
|
tc.isNudging = true;
|
||||||
|
Reference in New Issue
Block a user