Skip to content

fix: 60fps OFF toggle now takes effect without page reload (#1506)#3889

Draft
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/60fps-off-issue1506
Draft

fix: 60fps OFF toggle now takes effect without page reload (#1506)#3889
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/60fps-off-issue1506

Conversation

@jiangyj545
Copy link
Copy Markdown

Problem

Issue: #1506 — Allow 60fps: OFF does not work

Toggling "Allow 60fps" to OFF in the extension settings has no effect.
Videos continue playing at 60 fps even after disabling the option.

Root Cause

The MediaSource.isTypeSupported and HTMLMediaElement.prototype.canPlayType
patches (in js\&css/web-accessible/core.js lines 102-126) are only installed
when localStorage already contains it-codec or it-player30fps at
page load time:

if (localStorage["it-codec"] || localStorage["it-player30fps"]) {
    // ... patches installed here
}

On a fresh install (or when both codec blocking AND 60fps limiting are
disabled), neither key exists in localStorage → the overwrite hook is never
attached to the DOM APIs
. When the user later toggles 60fps OFF, the
storage-changed handler correctly sets localStorage["it-player30fps"] = true,
but nobody is listening — the patches were never installed.

Fix

Always install the patches (wrapped in an IIFE to avoid scope pollution).
The overwrite() function reads localStorage fresh on every invocation, so:

  • Codec blocking and 30fps filtering activate dynamatically when toggled
  • No page reload needed for the setting to take effect
  • No behavioral change when both features are disabled (overwrite passes through)

Changes

File Change
js\&css/web-accessible/core.js Removed if (localStorage[...]) guard; wrapped in IIFE

Testing

  1. Open YouTube with extension installed (fresh, no prior 60fps/codec settings)
  2. Open any 60fps video → should play at 60fps (default: ON)
  3. Go to extension settings → Player → toggle Allow 60fps to OFF
  4. Before fix: video continues at 60fps (bug)
  5. After fix: player drops to ≤30fps on next source switch/reload

Fixes #1506

…ity#1506)

Root cause: MediaSource.isTypeSupported and canPlayType patches were
only installed when localStorage already contained it-codec or
it-player30fps at page load time. If neither was set (fresh install
or both features disabled), the overwrite() hook was never attached,
so toggling 60fps OFF at runtime had no effect.

Fix: Always install the patches (wrapped in IIFE to avoid polluting
scope). The overwrite() function reads localStorage fresh on every
invocation, so codec/30fps filtering activates dynamically when the
setting changes — no reload needed.
@improvedtube-backup improvedtube-backup marked this pull request as draft May 24, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow 60fps: OFF dont work

2 participants