Hello guys, welcome to the 22nd session of create custom Alexa skill using AWS lambda function tutorial for beginners. In this session we will use audio player directive that is update speech message with playing your request to renew need to use add audio player play director method of response project it can take five parameters. First is playback behavior. It can be replaced all and cue and replace and depress all will begin playback immediately and playback at the end of the queue. Place and curve will remove all existing playback and add new in the queue. However, it will not reflect current playing track I'm using replaced on rockiness URL of the audio file I have a new same order that we have used in the previous session.
Next is going to identify this train. You can use any text but no longer than 124 characters. Here I'm using URL of the audio file as a token. So it will be unique for each audio file. Next is offset. A specifies offset in milliseconds from which audio will be played.
I want to play this from starting to select zero. Next as expected the previous token when you are using anchor this token is required, which specifies token for track after which this will be played. Here I have used to replace all so it is not required. Now we have created a handler for starting music but no write anything for stop or pause. Let us copy this music intent handler to create a new handler. Listen to this handler for pausing.
It is a special kind of intent. It will be added when we will adding an audio player interface for us to the need to execute it when audio player is playing online. Let us add a simple message to inform the user that stopping your music request. We need to call add audio claims top directive method. This method does not require any parameters, so remove those and we need to register for now save the file and deploy our lambda function. Here we also need to add permissions for audio players.
So click on interface. Enable audio player build models. Open JSON editor. Here you can see that it includes some predefined intents such as pause intent and resume intent. If you want to continue developing from xela then now we need to use ask clone command to clone an existing theme to your computer. Currently, the simulator does not support audio player directories, so you need to test it in your device.
I'm going to use my Echo Dot Alexa, open the second demo Welcome to your first Alexa skill from version two SDK playing your request Alexa, pause music stopping your music request hear it played audio as well as a stop as we have data. Now let us see what we are learning in this session. We can generate audio into race that is accessible and audio directed audio file must be followed specification provided by Amazon. Use this ffm PG library to convert your existing audio file and upload it to s3 bucket contains several predefined intents. Those are listed here we have used pausing Alexa support that Three audio player directories at the time of recording. Here we have use, play and stop.
You can also try clear cue to remove all tracks from the queue. And also try to use predefined intent to create your own custom music. This is an example we have used as a salmon to play audio, use audio tag and pass audio file URL in source attribute. To send an audio file using audio player directive, we need to use an audio player play to write to method in which we need to pass behavior or a URL token produced open and opposite. We can also attach a standard card or text message to our player. Recently, Amazon announced a metadata for the audio player which will display album art or Ecosport.
You may have stopped audio player on pause requests. You can also handle it in cancer intent. I have also chatted that we will stop it only if audio players Use an audio player stop directive method to stop. We have updated interface permissions from Steam console. But we can also change it from skills dot Jason dot file, but you need to manually add all intent required by the interface in interaction model. Thanks for watching this video.
If you have any doubts, please feel free to contact Have a nice day