Smooth YouTube livestream

5/11/2025, 9:27:12 PM

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
𝖢𝖸 𝖥𝗎𝗇𝗀
日安装量
3
总安装量
71
评分
0 0 0
版本
0.1.5
创建于
2025-05-11
更新于
2025-11-02
大小
4.5 KB
许可证
MIT
适用于

This userscript is designed to improve the smoothness of YouTube livestreams. Here's what it does:

  1. Trigger: It listens for the canplay event, which fires when a media element (like a video) is ready to play.
  2. Check if it's a livestream: It checks whether the element with class .ytp-live-badge.ytp-live-badge-is-livehead is present. This badge indicates a live stream.
  3. Target media elements: If a media element (like a video) is part of YouTube's player and is playing at normal speed (playbackRate === 1), it temporarily changes the playback speed to 0.968.
  4. Revert after 30 seconds: After 30 seconds, it sets the playback rate back to 1.0.

🧠 Purpose: Slightly slowing down a live stream for a short time helps buffer and can make the stream smoother, especially if you're falling slightly behind due to latency or network issues.


这个用户脚本是为了改善 YouTube 直播流的流畅度而设计的。其工作原理如下:

  1. 事件监听:监听 canplay 事件(当媒体元素准备好播放时触发)。
  2. 判断是否为直播:检查页面上是否存在 .ytp-live-badge.ytp-live-badge-is-livehead 元素(这是直播标志)。
  3. 处理媒体元素:如果检测到是 YouTube 播放器中的视频并且播放速度是正常(1.0),就将播放速度短暂设置为 0.968
  4. 30秒后恢复:30秒后再将播放速度恢复为 1.0

🧠 目的:这种微调播放速度的方式可以帮助视频稍微“追上”直播的实时进度,从而提升观看流畅度,特别是在出现网络延迟或缓冲时。