Skip to content

Fixing sabr fix when using Brave + uBO extension#336

Merged
ryanbr merged 1 commit into
brave:masterfrom
griffinallen:yt-sabr-ubo-fix
Jul 1, 2026
Merged

Fixing sabr fix when using Brave + uBO extension#336
ryanbr merged 1 commit into
brave:masterfrom
griffinallen:yt-sabr-ubo-fix

Conversation

@griffinallen

@griffinallen griffinallen commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

When using a uBO extension alongside Brave, the user was experiencing an issue where the player would get stuck in a refresh loop. This loop happened due to the following sequence of events:

Youtube - Video starts loading with the SABR delay
Brave SABR Fix - patches the backoff response
Youtube - Player receives patched response and enters video buffer state
Youtube - internally calls map.has(“onSnackbarMessage”)
uBO trusted-rpnt - hook on map.has, triggering the MutationObserver and then firing a loadVideoById event Youtube - Video starts loading again
Brave SABR Fix - patches the backoff response again
Youtube - Player receives patched response and enters video buffer state
Youtube - internally calls map.has(“onSnackbarMessage”)
uBO trusted-rpnt - hook on map.has, mutating the DOM, triggering the MutationObserver and then firing a loadVideoById event
Youtube - Video starts loading with the SABR delay …

To get around this issue. We can block the loadVideoById function from running while the video is being patched. Once the video is patched, we can then allow loadVideoById to run. This breaks the first phase of the loop where the uBO script triggers a loadVideoById event, giving us a fresh stream that we have to patch.

We may have to fine tune the timeout length of this in order to get a lag-free experience that works for all users.

When using a uBO extension alongside Brave, the user was experiencing an issue where the player would get stuck in a refresh loop. This loop happened due to the following sequence of events:

Youtube - Video starts loading with the SABR delay
Brave SABR Fix - patches the backoff response
Youtube - Player receives patched response and enters video buffer state
Youtube - internally calls map.has(“onSnackbarMessage”)
uBO trusted-rpnt - hook on map.has, triggering the MutationObserver and then firing a loadVideoById event
Youtube - Video starts loading again
Brave SABR Fix - patches the backoff response again
Youtube - Player receives patched response and enters video buffer state
Youtube - internally calls map.has(“onSnackbarMessage”)
uBO trusted-rpnt - hook on map.has, mutating the DOM, triggering the MutationObserver and then firing a loadVideoById event
Youtube - Video starts loading with the SABR delay
…

To get around this issue. We can block the loadVideoById function from running while the video is being patched. Once the video is patched, we can then allow loadVideoById to run. This breaks the first phase of the loop where the uBO script triggers a loadVideoById event, giving us a fresh stream that we have to patch.

We may have to fine tune the timeout length of this in order to get a lag-free experiences that works for all users.
@griffinallen griffinallen requested a review from ryanbr June 30, 2026 15:22
@ryanbr ryanbr merged commit 65cc707 into brave:master Jul 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants