Smooth YouTube livestream

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

作者
𝖢𝖸 𝖥𝗎𝗇𝗀
日安装量
1
总安装量
11
评分
0 0 0
版本
0.1.3
创建于
2025-05-11
更新于
2025-05-11
大小
4.4 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

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址