You cannot start a playback and wait for user response. Even during a playback, a user can only trigger build-in playback control intents.
When you send a AudioPlayer.Play
directive with a playBehavior="REPLACE_ALL"
, Alexa begins the playback of the specified stream, and replace current and enqueued streams.
While sending a Play
directive, you normally set the shouldEndSession
flag in the response object to true
to end the session. If you set this flag to false
, Alexa sends the stream to the device for playback, then immediately pauses the stream to listen for the user's response.
In ask-nodejs-sdk shouldEndSession
flag is automatically false
if you include a reprompt()
. As a result as soon Alexa receives this response it speaks the speech
and reprompt
and wait for user response (shouldEndSession=false
). If no response is there it will end the session as usual and the stream would never be played.
When your skill sends a Play
directive (shouldEndSession
flag set to true
) to begin playback, the Alexa service sends the audio stream to the device for playback. Once the session ends normally(when it begins playback), Alexa remembers that your skill started the playback and during this time, users can invoke any of the built-in playback control intents without using your skill's invocation name.
If you want to let the user guess a music that was played, you can use audio
tag of SSML. So that once the audio is played, it will wait for user response.
<speak>
Guess this music
<audio src="https://yoursoundsource.com/path/to/music.mp3" />
</speak>
Note: The audio file cannot be longer than ninety (90) seconds.
More on audio
tag here.
More on AudioPlayer
directives here.