Streaming live video as a macOS screensaver using AVFoundation and yt-dlp

7 points by hauxir


I built this to play live HLS streams as a screensaver on macOS. It supports both direct .m3u8 URLs and YouTube links (via yt-dlp extraction with caching).

The interesting bits:

Written in Swift using AVFoundation. The hardest part was dealing with macOS screensaver framework quirks - processes would stick around after dismissal until I added explicit idle detection using CGEventSource.

MIT licensed. Would appreciate any feedback on the approach or edge cases I might have missed.