展示 HN:macOS 动态屏保 – 一个播放实时视频流的屏保
Show HN: MacOS Live Screensaver – A screensaver that plays live video streams

原始链接: https://github.com/hauxir/macos-live-screensaver

## LiveScreensaver:将直播流转化为macOS和Android TV屏幕保护程序 LiveScreensaver可以将任何直播视频流转化为macOS和Android TV的动态屏幕保护程序。它支持YouTube直播流和直接HLS (.m3u8) 流。 对于macOS,该项目需要Xcode命令行工具,以及可选的`yt-dlp`用于YouTube支持(可通过Homebrew或pip安装)。安装过程包括构建屏幕保护程序并将其放置在“屏幕保护程序”文件夹中。配置通过“系统偏好设置”进行,您可以在其中输入所需的视频URL。 **重要提示:**仅支持*直播* YouTube流。该项目是在有限的Swift经验下开发的,并在配备M2芯片的macOS Tahoe上进行了测试 – 兼容性可能会有所不同。用户可能在macOS设置中遇到UI错误;有时重启“系统设置”可以解决问题。黑屏通常表示加载延迟或URL无效。

## MacOS 动态屏保总结 一款新的开源 MacOS 屏保允许用户显示实时视频流,它使用 AVFoundation 构建,并从 YouTube 等来源获取视频流。该项目由其创建者(承认自己是 Swift 新手)称为“氛围编码”的成果,引发了关于此类快速开发项目可维护性以及人工智能在编码中作用的讨论。 开发者们注意到了一些巧妙的 macOS 错误修复方案,特别是最近一个屏保返回桌面后仍然保持激活的问题。虽然代码相对简单(555 行),但讨论的重点在于可维护性的最佳实践——包括提交消息和代码注释——以及“氛围编码”是否是一种可持续的方法。 除了技术方面,该项目还引发了关于节能显示器时代屏保用途的怀旧对话,一些用户仍然出于美观原因或为了避免 OLED 显示屏的潜在烧屏而喜欢使用屏保。该创建者已经将项目扩展到了 Android TV 版本。
相关文章

原文

A macOS screensaver that plays live video streams. Supports YouTube videos and direct HLS streams.

Also available: Android TV Live Screensaver

Turn any live stream into your screensaver/lockscreen. Some examples:

Image Image Image
  • macOS
  • Swift compiler (Xcode Command Line Tools)
  • yt-dlp (optional, for YouTube support)

Disclaimer: This project was entirely vibe-coded. I've never written Swift before in my life.

Note: This was tested exclusively on macOS Tahoe on an M2 MacBook. Your mileage may vary on other versions/hardware.

Install yt-dlp (for YouTube support)

Using Homebrew:

Or using pip:

Build and install:

Or step by step:

make build
open build/LiveScreensaver.saver

Other commands:

make clean      # Remove build directory
make uninstall  # Remove screensaver from ~/Library/Screen Savers/
make start      # Trigger screensaver immediately
  1. Open System PreferencesScreen Saver
  2. Select Live Screensaver
  3. Click Options to configure
  4. Enter a video URL:
    • YouTube: https://www.youtube.com/watch?v=VIDEO_ID (live streams only)
    • HLS stream: https://example.com/stream.m3u8

Note: Only live YouTube videos are supported. Regular (non-live) YouTube videos will not work.

Image

Note: macOS screensaver UI can be buggy. If the Options button is unresponsive, try closing and reopening System Settings. PRs welcome for anyone who can figure out why.

YouTube videos don't play:

  • Make sure yt-dlp is installed and in your PATH
  • Verify you're using a live YouTube stream - regular videos are not supported

Black screen: Wait a few seconds for loading, or try a different URL

联系我们 contact @ memedata.com