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