Audioplayer

Learn more about how to build Alexa AudioPlayer Skills with the Jovo Framework.

Introduction to AudioPlayer Skills

AudioPlayer Skills can be used to stream long-form audio files like music or podcasts. The audio file must be hosted at an Internet-accessible HTTPS endpoint. The supported formats for the audio file include AAC/MP4, MP3, and HLS. Bitrates: 16kbps to 384 kbps. More information can be found here at the official reference by Amazon.

Get started by creating a new Jovo project with the alexa-audioplayer template:

Features

Play

Play a file. Speech will take place before the file begins to play.

play(url, token, playBehavior)

Play has the following parameters.

Name Description Value Required
url Specify the URL source of your audio must be HTTPS String YES
token An opaque token that represents the audio stream. This token cannot exceed 1024 characters. String YES
PlayBehavior Describes playback behavior. Accepted values:
REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams.
ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream.
REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream.
String NO - Defaults to REPLACE_ALL

Enqueue

Adds specified file to the play queue. remember that the URL must be HTTPS.

Name Description Value Required
expectedToken token of the currently playing stream String YES
url Specify the URL source of your audio must be HTTPS String YES
token An opaque token that represents the audio stream. This token cannot exceed 1024 characters. String YES

Stop

Stops the current file from playing.

Start Over

Starts the file specified by the url from the beginning.

Name Description Value Required
url Specify the URL source of your audio must be HTTPS String YES
token An opaque token that represents the audio stream. This token cannot exceed 1024 characters. String YES

Clear Queue

Use to clear all the queue or just the enqueue files.

Name Description Value Required
clearBehavior CLEAR_ALL - to clear everything
CLEAR_ENQUEUED- to clear just the queue.
String YES

Set Track Metadata

You can set track metadata that is used to show additional information for Alexa devices with a screen. Learn more about Audioplayer displays in the official reference by Amazon.

Name Description Value Required
title The title text to display String NO
subtitle Subtitle to display String NO
artwork URL for the image to display String NO
background URL for the background image to display STRING NO

For more information about the album artwork and the background image, refer to the official image guidelines by Amazon. Here are the recommended minimum sizes:

  • Artwork: 480 x 480 pixels
  • Background image: 1024 x 640 pixels

AudioPlayer Directives

Add the following to your handlers variable:

Note that it's important to have an emit at the end of the functions to be able to e.g. save user data. In the example above, we're using endSession for this.

Playback Controller

PlaybackController requests are used to notify you about user interactions with audio player controls, e.g. touch controls on Alexa-enabled devices.

All these requests are mapped to built-in intents inside the PLAYBACKCONTROLLER state. You can respond to them with AudioPlayer directives, e.g. play, pause, etc.

Comments and Questions

Any specific questions? Just drop them below. Alternatively, you can also fill out this feedback form. Thank you!

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.