question

newuser-b3b55a62-803b-4a9d-b6ce-d9264d978bcb avatar image

How to exit out of the skill when using audio play directives?

I am using audio player directive to play the audio. When I say 'stop' I just stop the audio now but I am trying to figure out a way for the user to come out of the app using some command since 'stop' would not boot him out of the skill. Any idea how to accomplish that?

 if (intent.name === "AMAZON.StopIntent") {
            this.stop();
            index=0; 
// Stops the playback of Audio
SimplePlayer.prototype.stop = function () {
    var response = {
        version: "1.0",
        response: {
            shouldEndSession: false,
            directives: [
                {
                    type: "AudioPlayer.Stop"
                }
            ]
        }
    };
    this.context.succeed(response);
};
skillintentsaudioaudioplayer
10 |5000

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

1 Answer

KAIYIN@AMAZON.COM avatar image
KAIYIN@AMAZON.COM answered

Do you want to stop the session while stopping the audio? If yes, you can set "shouldEndSession: true". If you want these two stops to be separated from each other, you can configure two different stop intent. Use the Amazon "stop" for the session stop, and configure another custom intent like "stop music" for stopping the audio.

If you want to use the same "AMAZON.StopIntent" for both, you can set session attributes, and flag the session attribute once the "AudioPlayer.Stop", and add it to the AMAZON.StopIntent saying that when session attributes are something like "audio.stop", and put shouldEndSession:true.

10 |5000

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