fix(adblock): harden isInlinePlaybackNoAd against property locker#458
fix(adblock): harden isInlinePlaybackNoAd against property locker#458marceldenzer wants to merge 1 commit into
Conversation
YouTube's server-side SABR "backoff" stalls playback after a few seconds when ads are stripped. The mitigation sets `playbackContext.contentPlaybackContext.isInlinePlaybackNoAd = true` so InnerTube serves no ads (and thus no backoff). YouTube ships a "locker" script that defines this property as non-writable/non-configurable via Object.defineProperty, so the previous in-place assignment silently failed and playback aborted with an error. Instead of mutating YouTube's object, rebuild the holder chain with fresh plain objects. JSON.stringify only serializes own enumerable properties, so spreading reproduces what would be serialized while dropping the locked descriptors, letting the flag stick. Fixes webosbrew#457 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
I just built and installed your branch and it didn't work, even after uninstalling the app and installing the ipk |
|
So you still have the same error? |
|
Can you upload the pre build ipk so I can test? |
|
Thanks, it's working here 👍 |
|
Tried this just now - casting from phone causes the app to crash irrecoverably. I had to uninstall it to get functionality back. Not rooted; managed via dev mode / dev manager. LG oled65g3pua @ 10.3.1-3001 |
|
Tested on LG C1 issue persists. |
|
Didn't work for me. |
|
having the same issue restarted the tv uninstalled reinstalled didnt work also the zip earlier didnt work either |
|
Just tested your file youtube.leanback.v4_0.5.3_all.ipk.zip and the issue still persists |
|
I'm fairly certain this is gonna be a lot harder to solve than this patch. At least on my tv that's rooted and on webos 6.2.0-31 with firmware 03.21.00 even removing all custom code in the IPK and leaving only an index.html with I suspect this is either because something has marked my YT account as more suspicious and thus has a lower threshold for other flags to trigger it. So I think there's a good chance we'll need to mimic the official app which uses cobalt as the webview instead. |
|
Can confirm that it did not work with the IPK for me |
|
+1 not working |
|
The problem persists for several days, updating from the main branch also did not help |
|
Well, I guess it has something to do with the account or anything else. I tested it for several days, and it still works a charm for me. Probably some geographical problem? I guess Kampfgurke is from Germany, just like me. Probably that’s why it works for us. |
|
Definitely seems account related. If you login as a guest on the app, it works fine, at least for a few videos before prompting you to sign in to verify you aren't a bot. The fact that the app works fine as a guest but not while signed in seems to indicate it's account related |
|
Yes, I just tested it also its definitely account based I changed accounts from the one I used daily to another and it works fine. Maybe youtube has done a new update that causes this not sure for now the work around is just use another google login. |
|
I don't think so, I use the same account on 2 different TV's the nano756pr and a ur73006la, on the 73006 the original yt adfree works all the time and on the nano756pr it works with the fix above 🤔 |
…ive catch-up) + hide merch QR - PR webosbrew#458: harden isInlinePlaybackNoAd against YouTube SABR property locker Fixes videos stopping after a few minutes (webosbrew#457) - PR webosbrew#463: live stream catch-up (skip to live edge when delay accumulates) New option in settings: 'Reduce live stream delay' - feat: hide merch/product QR codes during video playback (webosbrew#385) New option in settings: 'Hide merch/product QR codes' (enabled by default)
|
It is account specific. Me and my partner both have YT accounts logged in on the same LG C2 TV. Hers stopped working a week or so ago as she watches a lot more YT on the TV, now my account is doing the same thing today after watching some YT on my PC last night with Ublock on. My guess is Google is flagging accounts that it sees have low or no add watches. If you use the guest account it works fine for me, this might be a temporary workaround for now. |
|
it does work when anonymous but unfortunately youtube asks for login after a couple of videos, as soon as you login the error is back |


Problem
Playback aborts after a few seconds with a YouTube error screen when ads are stripped (e.g. #457). This is YouTube's server-side SABR "backoff": when the client receives no ads, the server instructs it to wait instead of sending media data, which surfaces as fake buffering and then an error.
The existing mitigation (added in #332) sets
playbackContext.contentPlaybackContext.isInlinePlaybackNoAd = truein player requests so InnerTube serves no ads — and therefore no backoff.Root cause
YouTube ships a "locker" script that defines
isInlinePlaybackNoAdas non-writable / non-configurable viaObject.defineProperty. The previous code set the flag with a direct in-place assignment (ctx.isInlinePlaybackNoAd = true), which silently fails against a locked descriptor (no throw in non-strict mode). The flag never makes it into the request, the backoff returns, and playback stalls.Fix
Instead of mutating YouTube's object in place, rebuild the holder chain (
holder → playbackContext → contentPlaybackContext) with fresh plain objects via spread.JSON.stringifyonly serializes own enumerable properties, so the spread reproduces exactly what would be serialized while dropping any locked property descriptors — so our flag sticks.The clone is only built when a
contentPlaybackContextis present and the flag isn't already set, so the hot path ofJSON.stringifyis unaffected.Testing
pnpm run lint:tsc,pnpm run lint:prettier,pnpm run lint:eslintandpnpm run buildall pass.[JSON.stringify] Set isInlinePlaybackNoAd.Fixes #457
🤖 Generated with Claude Code