- SignalDesk2小时前
Original Summary
Here is the prompt to build your own music MP3 player and internet radio for Amazon Alexa: [ 🎶 Jukebox for Alexa ] by @levelsio Build me a private Alexa skill that plays my own music from a cloud bucket, plus internet radio I want my Amazon Echo to play my own MP3s instead of being forced to use Amazon Music or Spotify. Build a private Alexa skill for this. Do as much as possible yourself: use CLIs and APIs, deploy and test it yourself, and only ask me for things only a person can do (logging in, clicking Allow, testing on the Echo). Setup - My music is in an S3-compatible bucket (AWS S3 or Cloudflare R2) under a music/ prefix. Each folder under it is a genre/playlist (music/Coffee Jazz/) or an artist/album (music/Artist/Album/). - I'll create an access key for the bucket and give it to you. Keep it in a config file and never print it. The skill only needs read access; the upload tools need write access. - My Echo and my Amazon developer account use the same Amazon login. Build 1. An Alexa-hosted (Node.js) custom skill with invocation name "jukebox" (use two words if Amazon rejects one) and the AudioPlayer interface enabled. 2. Voice model: a PlayIntent with an AMAZON.SearchQuery slot ("play {query}", "put on {query}", "tune in to {query}", "shuffle {query}"), a ShuffleAllIntent, a WhatsPlayingIntent, a ListStationsIntent, and all the built-in AudioPlayer intents (pause, resume, next, previous, loop on/off, shuffle on/off, start over). 3. Library: list everything under music/ with ListObjectsV2 (follow the continuation token), build folders from the key prefixes, keep only .mp3/.m4a/.aac files, and cache the result for 5 minutes. Match spoken phrases to folder and file names loosely: ignore track numbers and spacing ("ama piano" = amapiano), turn number words into digits ("thirteen beaches" = 13 Beaches), and handle genre aliases (dnb, drum n bass, hiphop, lo fi). 4. Playback: give Alexa a presigned HTTPS GET URL for each file. Make it valid for at least 12 hours so long mixes and pause/resume don't expire mid-play. Keep the bucket private. Store the play queue in the AudioPlayer token (folder, shuffle seed, position) so there's no database, and enqueue the next track on PlaybackNearlyFinished. Folders shuffle and loop. A folder whose files all start with track numbers is an album and plays in order. A single song carries on with the rest of its folder. 5. Radio: a stations list of HTTPS MP3/AAC/HLS streams, with good underground electronic stations (Rinse FM, NTS, Bassdrive, Intergalactic FM, Kiosk Radio, Refuge Worldwide, and so on) plus news (BBC World Service, NPR). Test every URL with curl first and drop the plain-HTTP ones, because Alexa refuses them. Support "play rinse fm", "drum and bass radio", "techno radio" and "the news", and make next/previous switch stations. Live streams drop and Alexa treats a drop as the end, so re-enqueue the same stream with a new token on PlaybackNearlyFinished, and retry once on PlaybackFailed. 6. Log one line per request (type, intent, token, offset, error) so playback problems show up in CloudWatch. Deploy without the web console - Install the ASK CLI (npm i -g ask-cli). If ask configure won't work in your shell, run ask util generate-lwa-tokens --no-browser, have me paste the one-time code, and write ~/.ask/cli_config yourself. Get the vendor ID from GET https://api.amazonalexa.com/v1/vendors. - The hosted skill's code is a git repo (find it with ask smapi get-alexa-hosted-skill-metadata). Push to master to deploy, with ask util git-credentials-helper as the git credential helper. The helper needs ask-resources.json and .ask/ask-states.json next to the repo. If pushes start failing with 403, clear the cached macOS keychain credential. - The hosted runtime may run an old Node version, so pin an S3 SDK version that supports it, or sign URLs with a small SigV4 library. - Upload the voice model with ask smapi set-interaction-model, check the skill manifest lists AUDIO_PLAYER, and test with ask smapi simulate-skill. The web console's simulator can't play audio, so a "problem with the requested skill's response" error there is expected. When it works, tell me how to add Alexa app routines (When: voice "coffee jazz" → Action: Customized "ask jukebox to play coffee jazz") so I can just say "Alexa, coffee jazz". And how to play internet radio stations I like. @levelsio : I love this time 😍 Everything is hackable now I now hacked my Amazon Alexa to play internet radio, including my own radio station @pieter but also @rinsefm and @bassdrive But also news radio like @bbcworldservice and @Bloomberg It's insane that this works, my Alexa just Link: https://x.com/levelsio/status/2112618575752229299
- 情报分类:工作与职业机会
- 分类依据:内容涉及招聘、求职或职业发展
- 信息来源:AI / AI前沿 / levelsio @levelsio
- 发布时间:2026/10/21 03:18:28
- 暂无回复