Skip to content

About

Twitch ad blocking userscript (vaft) for Tampermonkey, Violentmonkey and uBlock Origin. Fork of ryanbr/TwitchAdSolutions with extra fixes. Found a bug? Please open an issue with the [AD DEBUG] console log.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

TwitchAdSolutions

Latest version Downloads Last commit Validate JS License

Twitch ad blocking with the vaft userscript for Tampermonkey, Violentmonkey and uBlock Origin.
During ad breaks the stream keeps playing at 360p with sound instead of showing the ads.

Install · Fork changes · Scripts · Configuration · Troubleshooting

Fork of pixeltris/TwitchAdSolutions (archived). The script code is based on ryanbr/TwitchAdSolutions v68.5.7 plus the fixes listed below. All update URLs point to this repository.

Don't combine Twitch specific ad blockers.

Install

  1. Install a userscript manager: Tampermonkey (recommended) or Violentmonkey. On Safari: Userscripts. Greasemonkey doesn't work with the scripts.
  2. Chrome / Edge (Manifest V3): open chrome://extensions, click Details on the userscript manager and enable Allow user scripts.
  3. Tampermonkey: Dashboard → Settings → set Config mode to Expert → section Security → set Content Script API to UserScripts API Dynamic → Save. Without it Chrome may start the script after Twitch's player, and ads on that page are not blocked (vaft then reloads the player or the page once to recover).
  4. Open the vaft userscript and confirm the installation. Updates are then fetched automatically from this repository.
  5. Reload Twitch. In the browser console (F12) you should see [AD DEBUG] TwitchAdSolutions vaft v… loading and Worker intercepted — injecting ad-block hooks.

Remove any older TwitchAdSolutions / vaft userscript first (for example from pixeltris or ryanbr), otherwise both run at the same time.

What's different in this fork

Version Change
68.6.0 / 68.9.0 Missed worker recovery. If the userscript manager injects vaft after Twitch has started its video worker, no ad is ever detected on that page. vaft detects this, reloads the player once and, if that does not help, the page once (at most every 10 minutes per tab).
68.7.0 360p first (lowQualityFirst). On an ad break the 360p backup stream is tried first, so playback continues with sound instead of freezing while ad-laden full-quality backups are probed.
68.7.x / 68.8.1 Extra [AD DEBUG] diagnostics: switch and playback timing at ad start/end, ads vaft cannot detect, every client-side ad request.
68.8.0 Backup sequence alignment (alignBackupSequence). Backup playlists numbered differently from the live playlist froze the picture for 10–30 seconds at the start of a break; they are renumbered onto the live numbering now.
68.9.1 Your mute is kept. A mute set with the player button, the volume slider or the m key is no longer undone by the player reload after an ad break.
68.10.x Ad watchdog. If Twitch shows its ad label or countdown, vaft logs a short snapshot (Ad watchdog — lines in the console) of where the ad came from, even when it did not detect the ad itself. Playlists that bypass vaft's filter are logged as Untracked media playlist. Diagnostic only.

Details for every version are in the CHANGELOG. Every version is also published as a release with all scripts, a ZIP bundle and SHA-256 checksums.

Scripts

Script Userscript uBlock Origin Notes
vaft install resource / permalink Recommended. Swaps to an ad-free backup stream during ad breaks; the fork changes above apply to vaft only.
video-swap-new install resource / permalink Older approach, not recommended.
twitch-brave-fix install resource Companion for Brave only, if Twitch rejects requests because of Brave's fingerprint protection.

uBlock Origin

The userscript is recommended: uBlock Origin may stop applying the scripts for unknown reasons, and uBlock Origin Lite cannot load them at all.

  • Open the uBlock Origin dashboard. Under My filters add twitch.tv##+js(twitch-videoad).
  • Under Settings enable I am an advanced user, click the cog and set userResourcesLocation to the resource URL (append it with a space if a URL is already set), e.g. userResourcesLocation https://raw.githubusercontent.com/Helli24/TwitchAdSolutions/master/vaft/vaft-ublock-origin.js.
  • Disable and re-enable uBlock Origin (or restart the browser).

To stop using a script remove the filter and set the URL back to unset. Permalinks do not auto update; they are refreshed on every release.

Configuration

Settings are stored in the browser's localStorage for twitch.tv. Open the console on twitch.tv (F12), run the command and reload the page. The defaults work for most people.

// Set a value
localStorage.setItem('twitchAdSolutions_hideAdOverlay', 'true');

// Back to the default
localStorage.removeItem('twitchAdSolutions_hideAdOverlay');

// Show everything that is set
Object.keys(localStorage).filter(k => k.startsWith('twitchAdSolutions_')).forEach(k => console.log(k, '=', localStorage.getItem(k)));

Common settings (vaft):

Key Default Effect
twitchAdSolutions_hideAdOverlay not set true hides the "Blocking ads" banner on the player.
twitchAdSolutions_lowQualityFirst true Try the 360p backup first on every ad break. false probes full-quality backups first (better quality when one is clean, freezes when none is). Fork.
twitchAdSolutions_preferLowQualityBackup true Use the 360p backup when every full-quality backup carries ads.
twitchAdSolutions_reloadPlayerAfterAd true Reload the player after a break to return to full quality. false uses pause/play (faster, less reliable).
twitchAdSolutions_recoverFromSilentMute true Undo a mute Twitch sets on its own during a player reload. A mute you set yourself is kept (68.9.1).
twitchAdSolutions_playerType popout Player type used for stream tokens: popout, embed, site, autoplay (360p).

Advanced settings (vaft):

Key Default Effect
twitchAdSolutions_alignBackupSequence true Renumber backup playlists onto the live numbering at the switch. Fork.
twitchAdSolutions_unhookedPageReload true Allow the one-time page reload when vaft missed Twitch's video worker. Fork.
twitchAdSolutions_backupSwapFirst true Swap to a backup stream on ad detect. false strips ad segments from the live stream instead (legacy).
twitchAdSolutions_fastAutoplayFirstTry true After a break that needed 360p, try 360p first on the next break.
twitchAdSolutions_pinBackupPlayerType true Remember which backup type worked last (360p is never pinned).
twitchAdSolutions_reloadCooldownSeconds 30 Minimum seconds between player reloads; 0 disables it.
twitchAdSolutions_disableReloadCap not set true allows unlimited buffer-monitor reloads (risk of reload loops).
twitchAdSolutions_earlyReloadPollThreshold 3 Playlist polls (~2 s each) of frozen playback before an early reload; 0 disables it.
twitchAdSolutions_driftCorrectionRate 1.1 Playback rate used to catch up to live after a reload; 0 disables it.
twitchAdSolutions_softReloadNoStrip true Use a soft reload after breaks that stripped no segments.
twitchAdSolutions_disablePostBreakWedge not set true disables the "audio plays, video frozen" recovery after breaks.
twitchAdSolutions_disableAdSpoofing true (off) false sends fake "ad watched" events to Twitch. Not recommended.
twitchAdSolutions_iosSoftReload true iPhone/iPad only: soft instead of hard reloads.

Troubleshooting

  • Open the console (F12), type AD DEBUG into the filter and reload the page. See DEBUG.md for what the lines mean.
  • Ads play although vaft is installed: check for Worker intercepted after vaft … loading. If it is missing, see step 3 of Install.
  • An ad plays although Worker intercepted is there: vaft logs Ad watchdog — lines whenever Twitch shows its ad label or countdown, and Untracked media playlist when a playlist bypasses its filter. Include these lines in the issue.
  • More known issues: issues.md.
  • Still not working? Open an issue with the [AD DEBUG] console lines.

Known extension conflicts

  • 7TV: may cause black screen / infinite buffering (ryanbr#17).
  • TwitchNoSub: handled automatically, older versions may conflict.
  • TTV-AB, Purple AdBlock: Twitch ad blockers themselves. Use only one.
  • AdGuard Extra: works on a different layer and can be used alongside.

Other solutions

Proxies are the most reliable way of avoiding ads (buffering / downtime info):

Full list with descriptions · List maintained by @zGato

Credits

Based on pixeltris/TwitchAdSolutions and ryanbr/TwitchAdSolutions; vaft originates from cleanlock/VideoAdBlockForTwitch. Several fixes follow GosuDRM/TTV-AB. MIT License.

About

Twitch ad blocking userscript (vaft) for Tampermonkey, Violentmonkey and uBlock Origin. Fork of ryanbr/TwitchAdSolutions with extra fixes. Found a bug? Please open an issue with the [AD DEBUG] console log.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages