From 4250dc90fa8898554e8b750f206c4e75aa5c2948 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Oct 2025 18:02:12 +1000 Subject: [PATCH] Audio flash fix --- goodtube.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/goodtube.js b/goodtube.js index 4a976de..d9bf198 100644 --- a/goodtube.js +++ b/goodtube.js @@ -1566,7 +1566,7 @@ goodTube_page_api = document.getElementById('movie_player'); // Make sure the API is all good - if (!goodTube_page_api || typeof goodTube_page_api.seekTo !== 'function' || typeof goodTube_page_api.playVideo !== 'function') { + if (!goodTube_page_api || typeof goodTube_page_api.seekTo !== 'function' || typeof goodTube_page_api.playVideo !== 'function' || typeof goodTube_page_api.mute !== 'function' || typeof goodTube_page_api.setVolume !== 'function') { return; } @@ -1583,6 +1583,10 @@ // Sync the current time using the page API - 500ms (this is the only reliable way) goodTube_page_api.seekTo((syncTime - .5)); + // Then mute the video via the page API (this helps to prevent audio flashes) + goodTube_page_api.mute(); + goodTube_page_api.setVolume(0); + // Then mute the video via HTML (playing it unmutes it for some reason) youtubeVideoElement.volume = 0; youtubeVideoElement.muted = true;