question

Dean Tobler avatar image
Dean Tobler asked ·

Advanced Radio Station Streaming

I have successfully completed "Basic" skills for several radio stations as discussed here that simply direct Alexa to the station stream using the sample code from Github. My next question is how one would go about extending this Skill with additional functionality such as accessing Podcasts from an RSS Feed from the station website? I'm hoping that the ensuing discussion will be of help to other broadcasters looking to deliver alternate content through Alexa.

For the purpose of discussion, I have a Skill named BIG 95.3 (big ninety five point three) that correctly responds to the command "Alexa, play big ninety five point three." This station has a weekly program that we would like to have posted to the station's website as individual Episodes and give Alexa the ability to deliver them on demand to the listener. The invocation would be something like "Alexa, ask big ninety five point three to get the latest episode of Vinyl Express" or "Alexa, ask big ninety five point three to list episodes of Vinyl Express." In the second example here, Alexa would ideally respond with the Title of each available episode along with a brief description which the user could then interrupt with a command like "Play This Episode" or Alexa could ask if the listener wants to hear that episode and, if not, move on to the Title and Description of the next Episode.

Background For Radio People:

Vinyl Express is a popular locally-produced program that explores a different theme each week (Songs about Rain, Rivers, Eye Color, etc) and includes little known facts from behind the hits. Ultimately, I would like to have a way for listeners to select a program By Theme but I'm content with taking baby steps.

The station website is hosted by Intertech Media in the Amazon cloud with a flavor of Wordpress they call Wordpress For Broadcasters. The advantage with WPB (as they call it) is that it contains a strong Podcast facility that incorporates the ability to incorporate and manage Pre-Roll. The Podcast repository is readily accessible with RSS Feeds...they're not https yet but I'm inquiring about that.

Next Steps/Questions:

1) Can the existing skill be modified to include such functionality and, if so, should I be looking at Intents, Slots, or a combination thereof?

2) I think I have a fair understanding of how to add Intents and Slots in ASK (online) but become fuzzy when it comes to adding new code in Lambda for the new functions. What is the best way to go about adding/testing additional Lambda functionality?

Any and all input is appreciated!

alexa skills kitaudioaudioplayer
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-01d56fdb-332b-41be-95cd-542dbd1cf9d1 avatar image
newuser-01d56fdb-332b-41be-95cd-542dbd1cf9d1 answered ·

Hi. I cant offer an answer... but can I ask a further question.

I am building a similar skill (I will let you know if/when I do have an answer) so will follow this post with interest. BUT... I also want to add a "Now playing" element to the skill that can read the radio stations live stream and identify the song. I've seen this used on other radio skills but am unsure how to add it myself.

If you have any pointers they would be greatly appreciated.

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I haven't explored that yet but it is an interesting question. We use Wide Orbit for our audio streams and in our online "player" it does show the artist currently playing. I'm sure you're generally aware that the information is passed from the station's automation system into the stream encoder so that the streaming host "knows" what's playing. With that in mind, the streaming host should have the information so the question becomes, "How Will Your Skill Access It?" In other words, can you get a secure connection to the station's "As Play" log to poll for the most recent event from Alexa?

If so, I would think you could implement a routine where the listener asks something like, "Alexa, what song is this?" Even more intriguing, assuming this can be done, is to enable the listener to put the song in their Amazon Cart to add to their library.

0 Likes 0 ·
adamderann avatar image
adamderann answered ·

Hi, I'm not expecting this to be an answer, rather a bit more discussion for implementing your requirements in WordPress and using a HTTPS endpoint. Unfortunately I couldn't get on the WPB or intertechmedia website due to a 403 error to check what I say below.

I know in WordPress (not sure WPB) you can add meta fields to posts, using a field manager or similar to contain the mp3 of the podcast for that post - matching the post's title etc. One way I imagine you could get the required functionality requires some programming in PHP and WordPress to create a plugin that registers a WordPress API endpoint but then further web hosting the satisfies Alexa's strict HTTP endpoint requirements (or lambda).

https://wordpresssite.com/wp-json/my-alexa-podcast/v1/most-recent-podcasts

  • This API route would perform a WP_query for posts, filtering those that only contain featured media mp3s and create a list of these for "list episode intent".
  • Due to Alexa's setup not being able to take literal speech, you would need the skill to say, "Say Podcast 1 for <episode name>, say Podcast 2 for <episode name> ....." and store a variable in the session object such as "action":"play_from_list".
  • You could then setup an intent with "Podcast <number>" as demo data and when this is triggered and "action" in the session matches said value, send the Audioplayer directive with the mp3 in position <number> in the WordPress api list.
  • Only problem I could see with this is that if you publish a new post in the time Alexa says "Say Podcast 1..." and user saying, "podcast 1", the number could relate to a different (newer) mp3, effectively playing the wrong show.

https://wordpresssite.com/wp-json/my-alexa-podcast/v1/theme?q={INTENT_VALUE}

  • This API route in WordPress would return the mp3-post that has a meta field theme=INTENT_VALUE
  • You would need to register the custom intent values in the Alexa dashboard and certify it every time there's a new show theme - there's no way of getting around this until Amazon gives us the ability to populate intent values over an API like in Google's dialogflow (**HINT AMAZON**).
  • If there are more than 1 shows per theme, which I imagine there are, then a similar setup would need to be implemented above ie. say 1 for <episode title>.

Pre-roll could be managed in WordPress in the same plugin in an different endpoint with other settings formatted in JSON. The mentioned endpoints would create a JSON string which would be downloaded (preferably cached) on a web host that serves the Alexa skill, so it can respond quickly (cached every 5 mins for example).

From the past experience, you would need the result of AudioPlayer requests somewhere - a local database or firebase or something, as I had this problem with a streaming skill I created that also had the ability to play the latest podcast. It got rejected through certification because after pausing the podcast mp3, saying "play" caused the live stream to start at offset=0 and this is the big difference with multi-mp3 skills. The skill should have collected the token of the mp3 (in your case could be the mp3 url or wordpress post id) and the user id on every audioplayer request (pause & stop) and then after "play" again, remove this entry. In sending an AudioPlayer "play" response you should check in the database if this user has paused or stopped the audioplayer previously and, if so, respond with the token and the stored offset time to start from the paused positition in the mp3.

If you think there's a market for a hosted service such as this, I'd love to hear it.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.