From 741048263c3d87fe579a0489be7443cf3020c3c6 Mon Sep 17 00:00:00 2001 From: JensorX Date: Sun, 15 Feb 2026 17:13:36 +0100 Subject: [PATCH 1/2] feat: Add Advanced Settings Menu --- mods/config.js | 8 +++++++- mods/features/adblock.js | 39 ++++++++++++++++++++++++++++++++------- mods/ui/settings.js | 36 ++++++++++++++++++++++++++++++++++++ mods/ui/ui.js | 1 + 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/mods/config.js b/mods/config.js index 95632db6..f916fd26 100644 --- a/mods/config.js +++ b/mods/config.js @@ -47,6 +47,12 @@ const defaultConfig = { videoPreferredCodec: 'any', launchToOnStartup: null, disabledSidebarContents: [], + disable60fps: false, + disableAV1: false, + disableVP9: false, + disableAVC: false, + disableVP8: false, + disableHEVC: false, enableUpdater: true, autoFrameRate: false, autoFrameRatePauseVideoFor: 0 @@ -93,7 +99,7 @@ export const configChangeEmitter = { this.listeners[type].forEach(cb => { try { cb.call(this, event) - } catch (_) {}; + } catch (_) { }; }); } }; diff --git a/mods/features/adblock.js b/mods/features/adblock.js index 6f751ec0..81f8666b 100644 --- a/mods/features/adblock.js +++ b/mods/features/adblock.js @@ -36,14 +36,39 @@ JSON.parse = function () { r.paidContentOverlay = null; } - if (r?.streamingData?.adaptiveFormats && configRead('videoPreferredCodec') !== 'any') { + if (r?.streamingData?.adaptiveFormats) { + const disableAV1 = configRead('disableAV1'); + const disableVP9 = configRead('disableVP9'); + const disableAVC = configRead('disableAVC'); + const disableVP8 = configRead('disableVP8'); + const disableHEVC = configRead('disableHEVC'); + const disable60fps = configRead('disable60fps'); const preferredCodec = configRead('videoPreferredCodec'); - const hasPreferredCodec = r.streamingData.adaptiveFormats.find(format => format.mimeType.includes(preferredCodec)); - if (hasPreferredCodec) { - r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { - if (format.mimeType.startsWith('audio/')) return true; - return format.mimeType.includes(preferredCodec); - }); + + r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { + if (format.mimeType.startsWith('audio/')) return true; + + const lowerMime = format.mimeType.toLowerCase(); + if (disableAV1 && (lowerMime.includes('av1') || lowerMime.includes('av01'))) return false; + if (disableVP9 && (lowerMime.includes('vp9') || lowerMime.includes('vp09'))) return false; + if (disableAVC && (lowerMime.includes('avc') || lowerMime.includes('avc1'))) return false; + if (disableVP8 && (lowerMime.includes('vp8') || lowerMime.includes('vp08'))) return false; + if (disableHEVC && (lowerMime.includes('hev') || lowerMime.includes('hvc'))) return false; + + if (disable60fps && format.fps > 30) return false; + + return true; + }); + + // Preferred codec logic (if set and available) + if (preferredCodec !== 'any') { + const hasPreferredCodec = r.streamingData.adaptiveFormats.some(format => format.mimeType.includes(preferredCodec)); + if (hasPreferredCodec) { + r.streamingData.adaptiveFormats = r.streamingData.adaptiveFormats.filter(format => { + if (format.mimeType.startsWith('audio/')) return true; + return format.mimeType.includes(preferredCodec); + }); + } } } diff --git a/mods/ui/settings.js b/mods/ui/settings.js index 06531629..38f25eca 100644 --- a/mods/ui/settings.js +++ b/mods/ui/settings.js @@ -374,6 +374,42 @@ export default function modernUI(update, parameters) { } }) }, + { + name: 'Advanced Codec Settings', + icon: 'SETTINGS', + value: null, + menuId: 'tt-advanced-codec-settings', + menuHeader: { + title: 'Advanced Codec Settings', + subtitle: 'Individually deactivate specific codecs and high frame rates', + }, + options: [ + { + name: 'Disable 60fps (High Frame Rate)', + value: 'disable60fps' + }, + { + name: 'Disable AV1', + value: 'disableAV1' + }, + { + name: 'Disable VP9', + value: 'disableVP9' + }, + { + name: 'Disable AVC (H.264)', + value: 'disableAVC' + }, + { + name: 'Disable VP8', + value: 'disableVP8' + }, + { + name: 'Disable HEVC', + value: 'disableHEVC' + } + ] + }, window.h5vcc && window.h5vcc.tizentube && window.h5vcc.tizentube.SetFrameRate ? { name: 'Auto Frame Rate', icon: 'SLOW_MOTION_VIDEO', diff --git a/mods/ui/ui.js b/mods/ui/ui.js index c9428e3c..e0ef152d 100644 --- a/mods/ui/ui.js +++ b/mods/ui/ui.js @@ -10,6 +10,7 @@ import { pipToFullscreen } from '../features/pictureInPicture.js'; import getCommandExecutor from './customCommandExecution.js'; // It just works, okay? + const interval = setInterval(() => { const videoElement = document.querySelector('video'); if (videoElement) { From 6f1d1f97aedaf088ca94a2e3ec0de97bd9aa8b7e Mon Sep 17 00:00:00 2001 From: JensorX Date: Sun, 15 Feb 2026 17:16:42 +0100 Subject: [PATCH 2/2] remove empty spaces --- mods/config.js | 2 +- mods/ui/ui.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/config.js b/mods/config.js index f916fd26..4c78dc08 100644 --- a/mods/config.js +++ b/mods/config.js @@ -99,7 +99,7 @@ export const configChangeEmitter = { this.listeners[type].forEach(cb => { try { cb.call(this, event) - } catch (_) { }; + } catch (_) {}; }); } }; diff --git a/mods/ui/ui.js b/mods/ui/ui.js index e0ef152d..c9428e3c 100644 --- a/mods/ui/ui.js +++ b/mods/ui/ui.js @@ -10,7 +10,6 @@ import { pipToFullscreen } from '../features/pictureInPicture.js'; import getCommandExecutor from './customCommandExecution.js'; // It just works, okay? - const interval = setInterval(() => { const videoElement = document.querySelector('video'); if (videoElement) {