fix: 60fps OFF toggle now takes effect without page reload (#1506)#3889
Draft
jiangyj545 wants to merge 1 commit into
Draft
fix: 60fps OFF toggle now takes effect without page reload (#1506)#3889jiangyj545 wants to merge 1 commit into
jiangyj545 wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.isTypeSupportedandHTMLMediaElement.prototype.canPlayTypepatches (in
js\&css/web-accessible/core.jslines 102-126) are only installedwhen
localStoragealready containsit-codecorit-player30fpsatpage load time:
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-changedhandler correctly setslocalStorage["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 readslocalStoragefresh on every invocation, so:Changes
js\&css/web-accessible/core.jsif (localStorage[...])guard; wrapped in IIFETesting
Fixes #1506