aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-11-27 00:41:12 -0500
committerAjay <[email protected]>2024-11-27 00:41:12 -0500
commit8ce15e69fbd7a5b7058a3650a2dc903189700afc (patch)
tree6ac184ddef86b33e6ca2ddcd35627c45a3c8fd87 /src
parentd3cd0962d52b04a64e3f273ed31a89f4d79d5659 (diff)
downloadSponsorBlock-8ce15e69fbd7a5b7058a3650a2dc903189700afc.tar.gz
SponsorBlock-8ce15e69fbd7a5b7058a3650a2dc903189700afc.zip
Fix cases where skipping sometimes doesn't work
Should fix compatibility with new update to Enhancer for YouTube Should fix #2138
Diffstat (limited to 'src')
-rw-r--r--src/content.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/content.ts b/src/content.ts
index 663edc8a..a4d5222f 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -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
@@ -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();
}