Discovered by Astroolean
The technique exploits the interaction between ad playback and the browser's native Picture-in-Picture (PiP) functionality, rendering it highly resistant to conventional patching methods unless Twitch opts to disable PiP entirely.
Here's the Magic Trick:
- Grab my script and get it set up with Tampermonkey.
- The instant an ad pops up, hit that pause button on the ad itself.
- Then, simply switch your current stream into Picture-in-Picture mode.
- That's it! Enjoy seamless, ad-free streaming! This is truly a game-changer!
The Twitch Ad Muter & Enhancer is a powerful UserScript designed to significantly improve your Twitch viewing experience. It automatically mutes ads, attempts to bypass them, and even auto-claims your channel points, allowing for a more seamless and uninterrupted watching experience.
- Automatic Ad Muting: Automatically mutes the stream volume when a Twitch ad is detected.
- Ad Bypass (Experimental): Attempts to fast-forward or bypass ads when possible.
- Player Hiding (Optional): Can hide the video player during ads for a completely blacked-out ad experience (configurable).
- Pre-roll Ad Anticipation: Temporarily mutes/hides the player when loading a new stream to anticipate and mitigate pre-roll ads.
- Picture-in-Picture (PiP) Management: Smartly handles PiP mode during ads, ensuring your viewing preference is respected.
- Auto-Claim Channel Points: Automatically clicks the "Claim Bonus" button to collect your channel points.
- In-Player Options: Provides convenient buttons directly within the Twitch player interface to manually bypass ads or toggle fullscreen.
To use this UserScript, you'll need a browser extension that supports UserScripts, such as Greasemonkey (Firefox) or Tampermonkey (Chrome, Edge, Opera, Firefox).
-
Install a UserScript Manager:
-
Install the UserScript:
- Click on the Raw button of the
twitch-ad-muter-enhancer.user.jsfile in this repository. Your UserScript manager should automatically prompt you to install it. - Alternatively, you can create a new script in your UserScript manager and copy-paste the entire code into it.
- Click on the Raw button of the
Once installed, the script runs automatically in the background when you visit twitch.tv.
- Ad Muting & Hiding: Ads will be automatically muted. If
disableDisplayis set totrue(within the script's configuration, see below), the player will also be hidden. - Channel Points: Channel point bonuses will be claimed automatically when they appear.
- In-Player Options: Look for the "Ads Options" button near the viewer count on a live stream page. Clicking it will reveal additional buttons:
- Bypass Ad: Attempts to immediately end any detected ad.
- Fullscreen Current Stream: Toggles fullscreen for the currently active stream (even the small PiP stream during an ad).
-
Twitch Updates: Twitch frequently updates its website, which might temporarily break or reduce the effectiveness of this script. I will do my best to keep it updated.
-
Ad Blockers: This script works by muting and managing the player during ads. It's not a traditional ad blocker that prevents ads from loading, but rather handles their presentation. Using it alongside a standard ad blocker might yield mixed results or conflicts.
-
Debugging:
DEBUG_MODEis set totrueby default in the script. This will output extensive logs to your browser's console (F12, then "Console" tab), which can be helpful for troubleshooting. Remember to setDEBUG_MODEtofalseonce you're satisfied with the script's behavior to reduce console noise.
-
Inspired by various Twitch ad-muting solutions.
-
Research and help from ChatGPT Pro/Google AI Ultra/Replit Pro.
-
Both time and money was spent on this and it was released for free, your welcome.
You can customize some behaviors by editing the script directly in your UserScript manager. Look for the _tmuteVars object near the top of the script:
const _tmuteVars = {
timerCheck: 500, // Checking rate of ad in progress (in milliseconds; recommended: 250 - 1000)
disableDisplay: false, // Disable the player display during an ad (true = yes, false = no (default))
anticipatePreroll: false, // Temporarily mute and/or hide the player when loading a new stream to anticipate a pre-roll ad (true = yes, false = no (default))
anticipateTimer: 2000, // Time where the player is muted/hidden when loading a new stream for pre-roll anticipation (in milliseconds)
adUnlockAt: 270, // Unlock the player if this amount of seconds elapsed during an ad (in seconds)
adMinTime: 2, // Minimum amount of seconds the player will be muted/hidden since an ad started (in seconds)
// ... other internal variables
};