From 998b32a089bbea1dd2ad4dd312b5065b6c8b8a80 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Nov 2025 20:00:06 +1000 Subject: [PATCH] Play/pause fix, finally! --- goodtube.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/goodtube.js b/goodtube.js index b1f3326..a54f70c 100644 --- a/goodtube.js +++ b/goodtube.js @@ -3358,8 +3358,8 @@ return; } - // Don't do anything if we're holding control OR alt OR the command key on mac OR the "hide and mute ads" fallback is active - if (event.ctrlKey || event.altKey || event.metaKey || goodTube_fallback) { + // Don't do anything if we're holding control OR alt OR the command key on mac + if (event.ctrlKey || event.altKey || event.metaKey) { return; } @@ -3421,8 +3421,8 @@ return; } - // Don't do anything if we're holding control OR alt OR the command key on mac OR the "hide and mute ads" fallback is active - if (event.ctrlKey || event.altKey || event.metaKey || goodTube_fallback) { + // Don't do anything if we're holding control OR alt OR the command key on mac + if (event.ctrlKey || event.altKey || event.metaKey) { return; } @@ -3450,8 +3450,8 @@ return; } - // Don't do anything if we're holding control OR alt OR the command key on mac OR the "hide and mute ads" fallback is active - if (event.ctrlKey || event.altKey || event.metaKey || goodTube_fallback) { + // Don't do anything if we're holding control OR alt OR the command key on mac + if (event.ctrlKey || event.altKey || event.metaKey) { return; } @@ -3460,6 +3460,9 @@ // If double playback rate did not happen if (!goodTube_iframe_supportDoubleSpeed_doublePlaybackRate) { + // Re-target the video element (this fixes a weird issue where the play/pause doesn't work sometimes...) + goodTube_iframe_supportDoubleSpeed_videoElement = document.querySelector('video'); + // Click the video element (we must do it this way, it's the only reliable method) goodTube_iframe_supportDoubleSpeed_allowNextClick = true; goodTube_helper_click(goodTube_iframe_supportDoubleSpeed_videoElement); @@ -3549,6 +3552,7 @@ return; } + // Prevent default actions event.preventDefault(); event.stopImmediatePropagation(); @@ -3582,6 +3586,9 @@ // If double playback rate did not happen if (!goodTube_iframe_supportDoubleSpeed_doublePlaybackRate) { + // Re-target the video element (this fixes a weird issue where the play/pause doesn't work sometimes...) + goodTube_iframe_supportDoubleSpeed_videoElement = document.querySelector('video'); + // Click the video element (we must do it this way, it's the only reliable method) goodTube_iframe_supportDoubleSpeed_allowNextClick = true; goodTube_helper_click(goodTube_iframe_supportDoubleSpeed_videoElement);