aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay <[email protected]>2023-11-02 14:25:29 -0400
committerAjay <[email protected]>2023-11-02 14:25:29 -0400
commitb48c85492637c8e5eddaf890b338cfd74a648c9d (patch)
treefd5ebb9fea4f6efdeb56bc77eadc92d36b4705f5 /src
parent0bb7bef52c66a5c6ad0ed9ed840cbcdd53346c50 (diff)
downloadSponsorBlock-b48c85492637c8e5eddaf890b338cfd74a648c9d.tar.gz
SponsorBlock-b48c85492637c8e5eddaf890b338cfd74a648c9d.zip
Another fix for flashing on Firefox when skipping some segments at the end of the video
Diffstat (limited to 'src')
-rw-r--r--src/content.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/content.ts b/src/content.ts
index 03afcb16..9fbe4cb6 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -98,6 +98,8 @@ utils.wait(() => Config.isReady(), 5000, 10).then(() => {
});
const skipBuffer = 0.003;
+// If this close to the end, skip to the end
+const endTimeSkipBuffer = 0.5;
//was sponsor data found when doing SponsorsLookup
let sponsorDataFound = false;
@@ -622,7 +624,8 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
updateActiveSegment(currentTime);
- if (getVideo().paused) return;
+ if (getVideo().paused
+ || (getVideo().currentTime >= getVideo().duration - 0.01 && getVideo().duration > 1)) return;
const skipInfo = getNextSkipIndex(currentTime, includeIntersectingSegments, includeNonIntersectingSegments);
const currentSkip = skipInfo.array[skipInfo.index];
@@ -701,8 +704,12 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
forcedSkipTime = skipTime[0] + 0.001;
} else {
forcedSkipTime = skipTime[1];
- forcedIncludeIntersectingSegments = true;
forcedIncludeNonIntersectingSegments = false;
+
+ // Only if not at the end of the video
+ if (Math.abs(skipTime[1] - getVideo().duration) > endTimeSkipBuffer) {
+ forcedIncludeIntersectingSegments = true;
+ }
}
} else {
forcedSkipTime = forceVideoTime + 0.001;
@@ -1665,7 +1672,7 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
// MacOS will loop otherwise #1027
// Sometimes playlists loop too #1804
v.currentTime = v.duration - 0.001;
- } else if (v.duration > 1 && Math.abs(skipTime[1] - v.duration) < 0.5
+ } else if (v.duration > 1 && Math.abs(skipTime[1] - v.duration) < endTimeSkipBuffer
&& isFirefoxOrSafari() && !isSafari()) {
v.currentTime = v.duration;
} else {