fix: 60fps OFF toggle now takes effect without page reload (#1506)
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
- Open YouTube with extension installed (fresh, no prior 60fps/codec settings)
- Open any 60fps video → should play at 60fps (default: ON)
- Go to extension settings → Player → toggle Allow 60fps to OFF
- Before fix: video continues at 60fps (bug)
- After fix: player drops to ≤30fps on next source switch/reload
Fixes #1506