Fix crash from preview bar not being defined yet

This commit is contained in:
Ajay
2022-01-02 22:44:15 -05:00
parent 63f6702f86
commit 7895b9d2c1

View File

@@ -449,7 +449,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
if (!video) return;
if (currentTime === undefined || currentTime === null) currentTime = video.currentTime;
previewBar.updateChapterText(sponsorTimes, currentTime);
previewBar?.updateChapterText(sponsorTimes, currentTime);
if (video.paused) return;
if (videoMuted && !inMuteSegment(currentTime)) {
@@ -630,7 +630,7 @@ function setupVideoListeners() {
startSponsorSchedule();
} else {
previewBar.updateChapterText(sponsorTimes, video.currentTime);
previewBar?.updateChapterText(sponsorTimes, video.currentTime);
}
});
video.addEventListener('ratechange', () => startSponsorSchedule());