2 lines
4.1 KiB
Markdown
2 lines
4.1 KiB
Markdown
Prompt for the next LLM – “Implement a Lofi‑Radio App” Objective Build a cross‑platform app (web / Android / iOS) that streams the live audio from 20 popular lo‑fi 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 YouTube’s API (or via yt‑dlp). 3. Play the stream using an HLS‑aware media player. 4. Validate that the stream is working before starting playback. High‑level 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 Live‑Streaming 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 platform’s 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 end‑to‑end 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 5 minutes on each channel. 4. Error handling: - If the broadcast is not live, skip to the next channel. - If the API call fails (rate‑limit, 403), retry after a back‑off. 5. Logging: record each channel’s status (live, URL fetched, playback started). 6. User test: have a beta‑user listen for 30 minutes to catch any buffering or latency issues. List of 20 Lo‑fi 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 A–G above. 2. Pseudo‑code (no real code, just high‑level logic). 3. Test plan covering the validation steps. 4. Error‑handling 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.
|