mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Fix segments really close to eachother not skipping
Also combine segments that are closer than skip buffer Fix #1510
This commit is contained in:
parent
ff2cec699f
commit
0e0ae9165e
1 changed files with 5 additions and 3 deletions
|
@ -45,6 +45,8 @@ const utils = new Utils();
|
||||||
// Hack to get the CSS loaded on permission-based sites (Invidious)
|
// Hack to get the CSS loaded on permission-based sites (Invidious)
|
||||||
utils.wait(() => Config.config !== null, 5000, 10).then(addCSS);
|
utils.wait(() => Config.config !== null, 5000, 10).then(addCSS);
|
||||||
|
|
||||||
|
const skipBuffer = 0.003;
|
||||||
|
|
||||||
//was sponsor data found when doing SponsorsLookup
|
//was sponsor data found when doing SponsorsLookup
|
||||||
let sponsorDataFound = false;
|
let sponsorDataFound = false;
|
||||||
//the actual sponsorTimes if loaded and UUIDs associated with them
|
//the actual sponsorTimes if loaded and UUIDs associated with them
|
||||||
|
@ -608,7 +610,6 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
||||||
const skipTime: number[] = [currentSkip?.scheduledTime, skipInfo.array[skipInfo.endIndex]?.segment[1]];
|
const skipTime: number[] = [currentSkip?.scheduledTime, skipInfo.array[skipInfo.endIndex]?.segment[1]];
|
||||||
const timeUntilSponsor = skipTime?.[0] - currentTime;
|
const timeUntilSponsor = skipTime?.[0] - currentTime;
|
||||||
const videoID = sponsorVideoID;
|
const videoID = sponsorVideoID;
|
||||||
const skipBuffer = 0.003;
|
|
||||||
|
|
||||||
if (videoMuted && !inMuteSegment(currentTime, skipInfo.index !== -1
|
if (videoMuted && !inMuteSegment(currentTime, skipInfo.index !== -1
|
||||||
&& timeUntilSponsor < skipBuffer && shouldAutoSkip(currentSkip))) {
|
&& timeUntilSponsor < skipBuffer && shouldAutoSkip(currentSkip))) {
|
||||||
|
@ -1532,7 +1533,7 @@ function getLatestEndTimeIndex(sponsorTimes: SponsorTime[], index: number, hideH
|
||||||
const currentSegment = sponsorTimes[i].segment;
|
const currentSegment = sponsorTimes[i].segment;
|
||||||
const latestEndTime = sponsorTimes[latestEndTimeIndex].segment[1];
|
const latestEndTime = sponsorTimes[latestEndTimeIndex].segment[1];
|
||||||
|
|
||||||
if (currentSegment[0] <= latestEndTime && currentSegment[1] > latestEndTime
|
if (currentSegment[0] - skipBuffer <= latestEndTime && currentSegment[1] > latestEndTime
|
||||||
&& (!hideHiddenSponsors || sponsorTimes[i].hidden === SponsorHideType.Visible)
|
&& (!hideHiddenSponsors || sponsorTimes[i].hidden === SponsorHideType.Visible)
|
||||||
&& shouldAutoSkip(sponsorTimes[i])
|
&& shouldAutoSkip(sponsorTimes[i])
|
||||||
&& sponsorTimes[i].actionType === ActionType.Skip) {
|
&& sponsorTimes[i].actionType === ActionType.Skip) {
|
||||||
|
@ -1573,7 +1574,8 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
||||||
|
|
||||||
// Schedule at the end time to know when to unmute and remove title from seek bar
|
// Schedule at the end time to know when to unmute and remove title from seek bar
|
||||||
sponsorTimes.forEach(sponsorTime => {
|
sponsorTimes.forEach(sponsorTime => {
|
||||||
if (!possibleTimes.some((time) => sponsorTime.segment[1] === time.scheduledTime)) {
|
if (!possibleTimes.some((time) => sponsorTime.segment[1] === time.scheduledTime)
|
||||||
|
&& (minimum === undefined || sponsorTime.segment[1] > minimum)) {
|
||||||
possibleTimes.push({
|
possibleTimes.push({
|
||||||
...sponsorTime,
|
...sponsorTime,
|
||||||
scheduledTime: sponsorTime.segment[1]
|
scheduledTime: sponsorTime.segment[1]
|
||||||
|
|
Loading…
Reference in a new issue