mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 12:07:11 +03:00
Call incorrect videoID check when scheduling a skip.
This commit is contained in:
@@ -464,6 +464,8 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (incorrectVideoIDCheck()) return;
|
||||||
|
|
||||||
if (currentTime === undefined || currentTime === null) currentTime = video.currentTime;
|
if (currentTime === undefined || currentTime === null) currentTime = video.currentTime;
|
||||||
|
|
||||||
let skipInfo = getNextSkipIndex(currentTime, includeIntersectingSegments);
|
let skipInfo = getNextSkipIndex(currentTime, includeIntersectingSegments);
|
||||||
@@ -481,11 +483,9 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
let forcedSkipTime: number = null;
|
let forcedSkipTime: number = null;
|
||||||
let forcedIncludeIntersectingSegments = false;
|
let forcedIncludeIntersectingSegments = false;
|
||||||
|
|
||||||
|
if (incorrectVideoIDCheck()) return;
|
||||||
|
|
||||||
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
||||||
// Double check that the videoID is correct
|
|
||||||
// TODO: Remove this bug catching if statement when the bug is found
|
|
||||||
let currentVideoID = getYouTubeVideoID(document.URL);
|
|
||||||
if (currentVideoID == sponsorVideoID) {
|
|
||||||
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
|
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
|
||||||
|
|
||||||
// TODO: Know the autoSkip settings for ALL items being skipped
|
// TODO: Know the autoSkip settings for ALL items being skipped
|
||||||
@@ -495,14 +495,6 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
forcedSkipTime = skipTime[1];
|
forcedSkipTime = skipTime[1];
|
||||||
forcedIncludeIntersectingSegments = true;
|
forcedIncludeIntersectingSegments = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Something has really gone wrong
|
|
||||||
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
|
||||||
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
|
|
||||||
|
|
||||||
// Video ID change occured
|
|
||||||
videoIDChange(currentVideoID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime);
|
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime);
|
||||||
@@ -515,6 +507,27 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This makes sure the videoID is still correct
|
||||||
|
*
|
||||||
|
* TODO: Remove this bug catching if statement when the bug is found
|
||||||
|
*/
|
||||||
|
function incorrectVideoIDCheck(): boolean {
|
||||||
|
let currentVideoID = getYouTubeVideoID(document.URL);
|
||||||
|
if (currentVideoID == sponsorVideoID) {
|
||||||
|
// Something has really gone wrong
|
||||||
|
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
||||||
|
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
|
||||||
|
|
||||||
|
// Video ID change occured
|
||||||
|
videoIDChange(currentVideoID);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function sponsorsLookup(id: string, channelIDPromise?) {
|
function sponsorsLookup(id: string, channelIDPromise?) {
|
||||||
video = document.querySelector('video') // Youtube video player
|
video = document.querySelector('video') // Youtube video player
|
||||||
//there is no video here
|
//there is no video here
|
||||||
|
|||||||
Reference in New Issue
Block a user