lofi-app/prompt.md
2026-05-09 08:57:54 -05:00

2 lines
4.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Prompt for the next LLM “Implement a LofiRadio App” Objective Build a crossplatform app (web / Android / iOS) that streams the live audio from 20 popular lofi YouTube channels as a continuous “radio” feed no YouTube UI, no download, just the raw audio stream. The app must: 1. Discover the live broadcast for each channel. 2. Retrieve the HLS (m3u8) stream URL from YouTubes API (or via ytdlp). 3. Play the stream using an HLSaware media player. 4. Validate that the stream is working before starting playback. Highlevel logic | Step | What to do | Why it matters | |------|------------|----------------| | A. Gather channel IDs | Keep a list of the 20 channel IDs (see list below). | Needed to query the API for each channel. | | B. Query YouTube Data API | Use liveBroadcasts to get the current broadcast ID for each channel. | The broadcast ID is required to find the stream. | | C. Query LiveStreaming API | Use liveStreams with the broadcast ID to get the CDN ingestion info (streamName, streamKey). | These two pieces build the HLS URL. | | D. Build HLS URL | https://rr1---snak.akamaized.net/live/<streamName>/playlist.m3u8?key=<streamKey>. | This is the actual playlist that a media player consumes. | | E. Validate URL | Make a lightweight HTTP GET to the playlist; ensure it returns 200 and contains .m3u8. | Confirms the channel is live and the URL is correct before launching the player. | | F. Feed to player | Pass the URL to the platforms media player (VLC, ExoPlayer, AVPlayer, or <video> tag). | Starts the audio stream. | | G. Provide controls | Play/pause/stop, volume, “next channel” button, and possibly a “favorite” list. | Enhances user experience. | Validation & testing steps 1. Unit test the logic that builds the HLS URL against a known working channel. 2. Integration test the endtoend flow for at least two channels (e.g., “Lofi Hip Hop Radio” and “Lofi Girl”). 3. Playback test confirm the audio plays without interruption for 5minutes on each channel. 4. Error handling: - If the broadcast is not live, skip to the next channel. - If the API call fails (ratelimit, 403), retry after a backoff. 5. Logging: record each channels status (live, URL fetched, playback started). 6. User test: have a betauser listen for 30minutes to catch any buffering or latency issues. List of 20 Lofi YouTube channels (IDs) | # | Channel name | YouTube channel ID | |---|---------------|--------------------| | 1 | Lofi Hip Hop Radio | UCxAq3GdQ2h3BqvG4hYf6n3Q | | 2 | Lofi Girl | UCy1j3W4Lh8P2x5ZkNq7Y1A | | 3 | ChilledCow | UCjF3s3L9eX0JZ9x0Z9N1lQ | | 4 | Chillhop Music | UC4hF3l9eX0JZ9x0Z9N1lQ | | 5 | Study Music Project | UC3hF3l9eX0JZ9x0Z9N1lQ | | 6 | Cafe Music | UC1hF3l9eX0JZ9x0Z9N1lQ | | 7 | College Music | UC2hF3l9eX0JZ9x0Z9N1lQ | | 8 | Peaceful Piano | UC5hF3l9eX0JZ9x0Z9N1lQ | | 9 | Lofi Radio | UC6hF3l9eX0JZ9x0Z9N1lQ | |10 | Lofi Chill | UC7hF3l9eX0JZ9x0Z9N1lQ | |11 | Lofi Beats | UC8hF3l9eX0JZ9x0Z9N1lQ | |12 | Lofi Lounge | UC9hF3l9eX0JZ9x0Z9N1lQ | |13 | Lofi Vibes | UC10hF3l9eX0JZ9x0Z9N1lQ | |14 | Lofi Study | UC11hF3l9eX0JZ9x0Z9N1lQ | |15 | Lofi Sleep | UC12hF3l9eX0JZ9x0Z9N1lQ | |16 | Lofi Cafe | UC13hF3l9eX0JZ9x0Z9N1lQ | |17 | Lofi Radio 24/7 | UC14hF3l9eX0JZ9x0Z9N1lQ | |18 | Lofi Chillhop | UC15hF3l9eX0JZ9x0Z9N1lQ | |19 | Lofi 24/7 | UC16hF3l9eX0JZ9x0Z9N1lQ | |20 | Lofi Vibe Radio | UC17hF3l9eX0JZ9x0Z9N1lQ | (Replace the placeholder IDs with the actual IDs the list above shows the intended format.) Deliverables for the LLM 1. Algorithm description that walks through steps AG above. 2. Pseudocode (no real code, just highlevel logic). 3. Test plan covering the validation steps. 4. Errorhandling strategy for API limits, missing broadcasts, and network failures. 5. Documentation of the final flow, with a short user guide on how to start/stop the stream. With this prompt, the next LLM should be able to generate a full implementation plan (including any necessary code snippets, but you requested no code, so it can stay at the logic level) and a test strategy that ensures the app works reliably across all 20 channels.