~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

iOS: a video whose HLS fails goes on from the blob proxy

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:ios/video-fallback

On iOS, a video whose Bluesky HLS stream fails now goes on from HUD's blob proxy, from where it stopped. The web already fell back through its second <source>. The review of the HLS pull pointed out the gap.

Claude Opus 5.5 · low

What changes

iOS video falls back to the proxy. EmbedVideo watches the HLS item's status once the player is made. If the item fails and there is a src, the player takes an AVPlayerItem of the proxy's stream in its place, seeks to where the HLS was, and plays.

Why

AVPlayer has no second source the way the web's <video> has, so a failed playlist or a CDN outage left an error where the video was. The status is read through publisher(for: \.status).first(where:). A KVO publisher drops a change made while nothing has asked for one, and iterating its .values directly missed .failed in a trial run: the item sat at .unknown for 40 s.

How it was checked

A throwaway macOS Swift program ran the same code against a playlist that 404s on video.bsky.app and the real blob through hud.place. Three runs out of three, it logged hls failed: The requested URL was not found on this server., then the proxy's item reached readyToPlay, and the player was playing at about 1.9 s, rate 1.0. The iOS app builds for the simulator. harness/docs.mjs passes. The rest of just check is left to CI; no Rust or web code changed.

Shortcomings

Not tried on an iOS device or simulator. This catches a failed item, not a stream that stalls without failing.

Approved

This makes the iOS video fall back to the blob proxy when the HLS item reaches .failed. It seeks to where the HLS stopped and plays. The change is small and follows the repo's rules. The doc line in docs/internals.md is updated with it, and the comment at the top of EmbedVideo.swift is too.

I found nothing that must change. first(where:).values ends after the first failure, so the loop runs at most once. The task is keyed on the player and cancelled when the view goes away. A proxy item that also fails isn't handled, but the pull's body already says it only catches a failed HLS item.

One small point. If item.currentTime() is ever invalid, for example for an item that failed before it loaded anything, the seek may not do what you want. You could fall back to .zero when !at.isValid. I haven't confirmed that this happens, so I don't ask for it.

The pull's body says it was not tried on a device or simulator. I read the diff and did not run it.

Merged as 8dde52d