Fixed almost zero second sponsors skipping a little too late.

This commit is contained in:
Ajay Ramachandran 2020-03-30 14:11:46 -04:00
parent e62d46f2dd
commit 0d33794636

View file

@ -597,14 +597,14 @@ function sponsorsLookup(id: string, channelIDPromise?) {
// See if there are any starting sponsors
let startingSponsor: number = -1;
for (const time of sponsorTimes) {
if (time[0] <= video.currentTime && time[0] > startingSponsor) {
if (time[0] <= video.currentTime && time[0] > startingSponsor && time[1] > video.currentTime) {
startingSponsor = time[0];
break;
}
}
if (!startingSponsor) {
for (const time of sponsorTimesSubmitting) {
if (time[0] <= video.currentTime && time[0] > startingSponsor) {
if (time[0] <= video.currentTime && time[0] > startingSponsor && time[1] > video.currentTime) {
startingSponsor = time[0];
break;
}
@ -612,7 +612,7 @@ function sponsorsLookup(id: string, channelIDPromise?) {
}
if (startingSponsor !== -1) {
startSponsorSchedule(0);
startSponsorSchedule(startingSponsor);
} else {
startSponsorSchedule();
}