Fixed mobile YouTube starting sponsor detection that are not exactly 0 seconds.

This commit is contained in:
Ajay Ramachandran
2020-03-21 20:59:08 -04:00
parent 0467dd5d21
commit ed67cc52fe

View File

@@ -588,25 +588,25 @@ function sponsorsLookup(id: string, channelIDPromise?) {
UUIDs = smallUUIDs; UUIDs = smallUUIDs;
} }
// See if there are any zero second sponsors if (!video.paused && !switchingVideos) {
let zeroSecondSponsor = false; // See if there are any starting sponsors
for (const time of sponsorTimes) { let startingSponsor: number = -1;
if (time[0] <= 0) { for (const time of sponsorTimes) {
zeroSecondSponsor = true; if (time[0] <= video.currentTime && time[0] > startingSponsor) {
break; startingSponsor = time[0];
}
}
if (!zeroSecondSponsor) {
for (const time of sponsorTimesSubmitting) {
if (time[0] <= 0) {
zeroSecondSponsor = true;
break; break;
} }
} }
} if (!startingSponsor) {
for (const time of sponsorTimesSubmitting) {
if (time[0] <= video.currentTime && time[0] > startingSponsor) {
startingSponsor = time[0];
break;
}
}
}
if (!video.paused && !switchingVideos) { if (startingSponsor !== -1) {
if (zeroSecondSponsor) {
startSponsorSchedule(0); startSponsorSchedule(0);
} else { } else {
startSponsorSchedule(); startSponsorSchedule();