mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-05-11 10:26:23 +02:00
Fix skipping accuracy with bluetooth headphones on firefox
This commit is contained in:
parent
1fa886690a
commit
a4bb17f935
1 changed files with 3 additions and 3 deletions
|
@ -772,7 +772,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
|
|||
|
||||
// Use interval instead of timeout near the end to combat imprecise video time
|
||||
const startIntervalTime = forceStartIntervalTime || performance.now();
|
||||
const startVideoTime = Math.max(currentTime, getCurrentTime());
|
||||
const startVideoTime = Math.max(currentTime, getVirtualTime());
|
||||
delayTime = (skipTime?.[0] - startVideoTime) * 1000 * (1 / getVideo().playbackRate);
|
||||
|
||||
let startWaitingForReportedTimeToChange = true;
|
||||
|
@ -791,7 +791,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
|
|||
}
|
||||
|
||||
const intervalDuration = performance.now() - startIntervalTime;
|
||||
if (intervalDuration + skipBuffer * 1000 >= delayTime || getCurrentTime() >= skipTime[0]) {
|
||||
if (intervalDuration + skipBuffer * 1000 >= delayTime || getVirtualTime() + skipBuffer >= skipTime[0]) {
|
||||
clearInterval(currentSkipInterval);
|
||||
if (!isFirefoxOrSafari() && !getVideo().muted && !inMuteSegment(getCurrentTime(), true)) {
|
||||
// Workaround for more accurate skipping on Chromium
|
||||
|
@ -842,7 +842,7 @@ function getVirtualTime(): number {
|
|||
(performance.now() - lastKnownVideoTime.preciseTime) * (getVideo()?.playbackRate || 1) / 1000 + lastKnownVideoTime.videoTime : null);
|
||||
|
||||
if (Config.config.useVirtualTime && !isSafari() && virtualTime
|
||||
&& Math.abs(virtualTime - getCurrentTime()) < 0.2 && getCurrentTime() !== 0) {
|
||||
&& virtualTime > getCurrentTime() && virtualTime - getCurrentTime() < 0.2 && getCurrentTime() !== 0) {
|
||||
return Math.max(virtualTime, getCurrentTime());
|
||||
} else {
|
||||
return getCurrentTime();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue