Fixing sabr fix when using Brave + uBO extension#336
Merged
Conversation
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.
ryanbr
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
loadVideoByIdfunction from running while the video is being patched. Once the video is patched, we can then allowloadVideoByIdto run. This breaks the first phase of the loop where the uBO script triggers aloadVideoByIdevent, 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.