Added check for videoID change not being called

This commit is contained in:
Ajay Ramachandran 2020-03-30 20:08:00 -04:00
parent 4a6ddf6774
commit a9993d5d80

View file

@ -479,12 +479,24 @@ function startSponsorSchedule(currentTime?: number): void {
let forcedSkipTime: number = null;
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice);
// 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.index, skipInfo.array, skipInfo.openNotice);
if (Config.config.disableAutoSkip) {
forcedSkipTime = skipTime[0] + 0.001;
if (Config.config.disableAutoSkip) {
forcedSkipTime = skipTime[0] + 0.001;
} else {
forcedSkipTime = skipTime[1];
}
} else {
forcedSkipTime = skipTime[1];
// 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);
}
}