Skip to content

Commit

Permalink
Fix cases where skipping sometimes doesn't work
Browse files Browse the repository at this point in the history
Should fix compatibility with new update to Enhancer for YouTube

Should fix #2138
  • Loading branch information
ajayyy committed Nov 27, 2024
1 parent d3cd096 commit 8ce15e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,7 @@ function incorrectVideoCheck(videoID?: string, sponsorTime?: SponsorTime): boole
let playbackRateCheckInterval: NodeJS.Timeout | null = null;
let lastPlaybackSpeed = 1;
let setupVideoListenersFirstTime = true;
function setupVideoListeners() {
const video = getVideo();
function setupVideoListeners(video: HTMLVideoElement) {
if (!video) return; // Maybe video became invisible

//wait until it is loaded
Expand Down Expand Up @@ -1460,10 +1459,10 @@ async function channelIDChange(channelIDInfo: ChannelIDInfo) {
if (Config.config.forceChannelCheck && sponsorTimes?.length > 0) startSkipScheduleCheckingForStartSponsors();
}

function videoElementChange(newVideo: boolean): void {
function videoElementChange(newVideo: boolean, video: HTMLVideoElement): void {
waitFor(() => Config.isReady()).then(() => {
if (newVideo) {
setupVideoListeners();
setupVideoListeners(video);
setupSkipButtonControlBar();
setupCategoryPill();
}
Expand Down

0 comments on commit 8ce15e6

Please sign in to comment.