To Fix Brave Bug for YouTube Live Chat
This is to fix the bug for Brave. (YouTube Live Chat)
Target User: Brave
See https://community.brave.com/t/youtube-live-chat-30-sec-delay/
YouTube calls "urlChanged" twice to set the iframe url.
In the first attempt, chatframe.contentDocument
is null. So it will set the src
of the iframe.
In the second attempt, chatframe.contentDocument
is non-null. So it will set the url using chatframe.contentDocument.location.replace
Both Brave and Chrome will do these two attempts. Both attempts are just 10ms aparted.
The difference is, in brave, the first attempt affected the second attempt, but in chrome, the first attempt would not affect the second attempt.
Below is an analysis of the issue reported in the thread “YouTube live chat 30 sec delay” on the Brave Community forum:
Users have reported that when watching YouTube live streams in Brave (using the default, non‐private browsing mode), the live chat is delayed by approximately 30 seconds. In contrast, both YouTube’s video/audio and live chat load immediately when viewed in Chrome or Brave’s private mode. This inconsistency points to a problem that appears to be specific to the normal browsing profile in Brave.
Reproduction Steps:
Observed Behavior:
Based on the discussion in the thread, several potential causes have been identified:
Profile-Specific Data or Caching:
Since the issue does not occur in private mode or a fresh profile, it suggests that certain cached data or cookie settings in the default profile might be interfering with the live chat loading.
Interference from Extensions or Ad Blocking:
Although users have reported disabling all extensions and lowering shields, network logs (showing errors like net::ERR_BLOCKED_BY_CLIENT
) hint that some requests may still be getting blocked. This might indicate residual interference from ad-blocking or tracking protection rules inherent to Brave.
Browser Bug in Handling YouTube API Requests:
The log snippets reveal delayed or blocked requests related to YouTube’s API (e.g., delay parameters in the URL). This suggests that a bug in how Brave handles certain YouTube API requests—possibly introduced in the version of Brave using Chromium 105—could be responsible.
Clearing Cookies:
Some users speculated that cookie data might be the culprit, as one comment noted that the problem might be resolved by clearing cookies. However, at least one user mentioned that clearing cookies for Google domains did not help.
Creating a New Profile:
Testing with a new profile appears to temporarily resolve the issue. This supports the idea that some settings or cached data in the original profile might be contributing to the delay.
Intermittent Nature:
Even within new profiles, users have observed that after interacting with certain elements on the live stream (such as closing polls), the delay can reoccur. This points to a complex interaction between profile settings and YouTube’s dynamic elements.
The issue of the 30-second delay in YouTube live chat on Brave is likely due to a combination of profile-specific data/caching and Brave’s handling of certain API requests or network calls. The fact that the problem does not occur in private mode or on other browsers (like Chrome) suggests that it is not an inherent incompatibility with YouTube but rather a bug or misconfiguration within the normal browsing mode of Brave. Users facing this issue may find temporary relief by using private mode or creating a new profile, but a long-term fix would likely need to come from an update or patch from the Brave development team.
Below is a detailed analysis of the GitHub issue #25694:
Title: YouTube live chat remains blank for 30 seconds on live streams
Status: Closed (fixed by brave/brave-core#24763)
Reported by: @snowbound on September 29, 2022
This issue concerned a delay in the live chat’s appearance when viewing YouTube live streams in Brave. Users observed that—even though the video would start playing normally—the chat window remained blank for about 20–30 seconds.
These reproduction steps were confirmed in both beta and release channels, while other browsers (like Chrome, Firefox, and Edge) did not exhibit this delay.
Based on the investigative comments from Brave developers:
The analysis of issue #25694 demonstrates a classic case where a feature (live chat) suffered from timing issues—likely exacerbated by the browser's ad handling and client hints implementation. The resolution involved adjusting the load sequence and handling of client hints, and it has since been verified as fixed in subsequent builds. This serves as a reminder of the balance needed between privacy features and seamless user experience in modern browsers.