Repository navigation
feat(play): queue YouTube radio links and start playback faster - #12
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
watch?v=…&list=RD…) now queues the radio's first 25 songs as a playlist. Before, thev=parameter made it play only the seed video./playno longer runs two full yt-dlp extractions back to back. Resolution extracts once (yt-dlp -J), caches the info JSON in memory, and the stream starts from it through--load-info-json -. Measured first audio byte: 0.67 s cached vs 4.99 s fresh.Changes
packages/server/src/lib/youtube.tsisRadioUrlandRADIO_TRACK_LIMIT = 25packages/server/src/lib/infoCache.tspackages/server/src/index.ts--playlist-end 25;getVideoInfoextracts with-Jand caches;createAudioStreamstreams from the cache and falls back to a fresh extractionREADME.mdDesign notes
it resolves in ~1.3–1.8 s. - Why the cache is safe: the 10-minute TTL is far below the ~6 h lifetime of YouTube's signed
media URLs, so a cached entry never streams from an expired URL. A missing, expired or already-usedentry falls back to today's extraction.
watch?v=X&list=PL…still plays tst=RD…is rejected by YouTube ("Thisplaylist type is unviewable"), so only thewatch` form counts as a radio.Test plan
bun build src/index.ts --target bun: exit 0 - [x] Live yt-dlp: radio with--playlist-end 25→ 25 entries in 1.8 s; first audio byte 0.67 scached vs 4.99 s fresh
/playwith a single YouTubelink,/playwith a radio linkKnown limitations
Supersedes #10, which was merged intinstead of
mainafter #9 landed, so these commits never reachedmain.