fix(resolve,player): play HLS (.m3u8) radio streams via ffmpeg#259
Conversation
HLS playlists were parsed as track lists, so the master playlist's relative chunklist_*.m3u8 URI became a bogus local-file track (open source: ... no such file or directory). Detect HLS in resolveM3U and return a single stream Track with the original URL; route .m3u8 stream URLs to ffmpeg-by-URL in the player pipeline so ffmpeg resolves relative chunklist/segment URIs and follows the live segment window.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughDetect .m3u8/HLS by extension and playlist markers, buffer remote playlists up to 1MB to classify HLS vs plain M3U, return HLS playlists as single stream entries with realtime inference, route HLS URLs to ffmpeg decoding to preserve relative segment resolution, and add tests/docs for the behavior. ChangesHLS Stream Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- hoist formatExt so the HLS branch and the format fallback share one parse - comment that EXT-X-ENDLIST detection is conservative behind master playlists - mention HLS streaming on the site (docs/site sync convention) - docs style: drop em dash
Summary
HLS radio streams (
.m3u8playlists) failed to play.resolveM3Uparsed the remote.m3u8as a track list with an emptybaseDir, so the master playlist's relative variant URI (chunklist_<uuid>.m3u8) was treated as a local file and playback died withopen source: open chunklist_<uuid>.m3u8: no such file or directory. Chunklist names rotate per request and segments are relative, so this can't be fixed by parsing — the robust fix is to let ffmpeg (already a cliamp dependency for AAC/Opus) handle HLS end-to-end.Two changes:
resolve.resolveM3U: detect HLS playlists (#EXT-X-*tags) and return a single streamTrackwith the original URL instead of parsing it as a track list.player: route.m3u8stream URLs todecodeFFmpegStream(ffmpeg-by-URL) so ffmpeg resolves the relative chunklist/segment URIs and follows the live segment window. This also covers stations added viaradios.toml/favorites, which already hand the player a.m3u8URL directly.ffmpeg is already required for AAC/Opus, so no new dependency.
Screenshots / video
N/A — no UI changes.
How to test
Unit (no network):
go test ./resolve/ ./player/Covers HLS detection (master/media/plain),
resolveM3Ureturning a single stream for HLS vs. N tracks for a plain playlist, andisHLS.Live playback (needs ffmpeg + network) — e.g. a Brazilian RBS/Wowza station:
ffmpeg decoding proof (the exact command cliamp now runs):
Checklist
make checkpassesdocs/andsite/index.htmlupdated for user-facing changesSummary by CodeRabbit
New Features
Documentation