The Super Simple AudioPlayer Project
The easiest way to get started with the Alexa AudioPlayer
Bespoken Tools provides Alexa skill developer tools and an all-in-one Alexa skills lifecycle management platform with logging, metrics, APM and analytics services.
We’ve created a new Github project, the Super Simple AudioPlayer. Its purpose is to demonstrate how to use the Alexa AudioPlayer in the easiest way possible.
The project has no code dependencies, uses no frameworks, and is meant to illustrate as simply and transparently as possible how the AudioPlayer works. We hope you find it useful!
It is structured as Javascript/NodeJS Lambda. To get started using it, just follow our README.
What does this skill do?
- It plays an introduction to the user explaining how it works
- It plays a hard-coded MP3 audio file when the user says “Play”
- It can Pause and Resume, using a simple in-memory cache
How can I use it?
Short answer — any way that you want ;-)
Really, though, this is meant as a starting point for people wanting to understand how the AudioPlayer works and do some basic things with it.
For that reason, it is heavily stripped down so that you can see the behavior up-close, without frameworks getting in the way. For example, here is the code for playing a track:
As you can see, the distance between the code and the raw Alexa JSON is absolutely minimal.
What is next?
We plan on expanding on this project, evolving this simple example into a fully functional player. With each addition, it will still be possible to easily access the previous, simpler version. We hope this incremental approach keeps the project simultaneously easy to understand while also guiding readers to a full-fledged implementation.
Features we plan to add:
- Use of Playlists
- Saving state with DynamoDB
- Unit Testing
- Shuffle and loop
Let us know if there are other aspects you would like to see covered — we welcome the input! Just comment below. And watch or follow the project here.
(Image via Spin The Black Circle — article repost from the Bespoken Blog)