chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
0
0
Videos play Bluesky's HLS, and the blob proxy serves them as they arrive
Merged Approved
This pull plays Bluesky's HLS (hls) where the platform plays it. It also makes the blob proxy download each audio or video blob once per DID and CID, and serve it while it arrives. I read every changed file and found nothing that must change.
Filling::readandDownload::run:readableholds back the last byte until the hash matches. If a blob is shorter than the PDS said, a read ends in an error. If it fails, the scratch file is removed and the in-flight entry is dropped beforedoneis sent, so a later request starts a fresh download. The readers' open file handle survives both the rename into the cache and eviction.- Stalled PDS: the PDS request already carries
.timeout(BODY_WAIT), which covers the body. A stalled PDS can therefore hold a detached download for 120 s at most. hlsgating: the resolver accepts a playlist only onhttps://video.bsky.appunder/watch/. The tests cover http, another host, another path and a bad URL. The schema, the types, the web player and the iOS player all carry the field, and the CSP tests check the two video origins.
Two small things you may already know:
- On iOS, if the HLS stream fails,
AVPlayerhas no fallback tosrc. The web has one through the second<source>. - The same-instant double download is a gap you already list.
Merged as 7b6e57d
A post's video buffered so slowly on the web and iOS that it was hard to watch. Bluesky's videos now play its own adaptive HLS from its CDN wherever the platform plays HLS itself. The blob proxy, still the fallback and still what plays other apps' video and audio, now serves a blob as it arrives, downloaded once.
Claude Opus 5.5 · low
What changes
Bluesky's HLS. The resolved video embed has
hls, the post's playlist, only where it ishttps://video.bsky.app/watch/…(blobs::VIDEO_ORIGINS). The web's<video>lists it first, typedapplication/vnd.apple.mpegurl, then the proxy, so Firefox, which plays no HLS, falls back to the proxy. iOS'sAVPlayerplayshls ?? src. A video with anhlsbut nosrcplays too, and gets no "Play on Bluesky" link. Both CSPs already allowedvideo.bsky.appandvideo.cdn.bsky.appthrough the bundled Bluesky views'origins; tests now hold them to it.place.hud.uigrows an optionalhls. The AGENTS.md rule on what the view loads now names Bluesky's video service and CDN.The proxy serves audio and video as they arrive.
BlobCache::filldownloads a blob once per DID and CID, in a task of its own that keeps going after the requester leaves. Every request for it, the first and any that come while it downloads, reads the scratch file as it grows (Filling::read), against the length the PDS said. A blob's last byte is held back until the whole hashes to its CID, so no read of it completes unverified. A PDS that gives no length is answered once all of it is kept, as before.BlobCache::putis gone. Cached blobs are read in 64 KiB chunks rather thanReaderStream's default 4 KiB.Why
Measured against hud.place:
Bluesky's HLS is adaptive (360p/720p, 6 s segments) and served from BunnyCDN's edge. It needs no hls.js: AVPlayer, Safari and Chrome 150 play it natively.
Sharing a download only within one DID keeps one PDS's bytes from being served for another account's URL before they are verified.
How it was checked
just checkpassed, with lines and functions at 100%. New tests:blobcache: readers follow a download; the last byte waits for the hash; reads end in why for a mismatch or for a blob shorter than said.blob.rs: a video served in ranges before its second half arrived, from one PDS request.embed.rs: whenhlsis set.A local
hud serveproxying a real 10 MB Bluesky video answeredbytes=0-1cold in 0.93 s; a joinedbytes=0-started in 2 ms and streamed at PDS speed. Kept bytes hash to the CID.In headless Chromium 150, under the workspace's
media-src:currentSrcwas the playlist and it played at 360p.The iOS app builds for the simulator.
Shortcomings
Review
Start at
Filling::readandDownload::runincrates/hud-core/src/blobcache.rs.