question

Arnout Cator avatar image
Arnout Cator asked

Is APL supported on a skill using audio player interface?

Hi, I have implemented in nodejs 12 successfully a multistream skill on the basis of this project's implementation:

https://github.com/alexa/skill-sample-nodejs-audio-player

Now that I have got this skill running, I thought I experiment if I could get a background image added to the simpleCard. I designed and implemented APL by generating a json file from the APL UI and I have applied conditional code to distinguish between devices that have display and those that do not like this:


if(deviceHasDisplay(handlerInput)){

if (await canThrowCard(handlerInput)) {

const cardTitle = `Playing ${playlist.title}`;

const cardContent = `Playing ${playlist.title}`;

console.log(`device has display -- card title is ${playlist.title}`);

responseBuilder

.withSimpleCard(cardTitle, cardContent)

.addDirective({

type: 'Alexa.Presentation.APL.RenderDocument',

document: './prajna.json',

dataSources: {}

});

}

} else {

if (await canThrowCard(handlerInput)) {

const cardTitle = `Playing ${playlist.title}`;

console.log(`no display -- card title is ${playlist.title}`);

const cardContent = `Playing ${playlist.title}`;

responseBuilder.withSimpleCard(cardTitle, cardContent);

}

}

return responseBuilder.getResponse();

}


/** Check for a device with a display */

function deviceHasDisplay(handlerInput){

var result =

handlerInput &&

handlerInput.requestEnvelope &&

handlerInput.requestEnvelope.context &&

handlerInput.requestEnvelope.context.System &&

handlerInput.requestEnvelope.context.System.device &&

handlerInput.requestEnvelope.context.System.device.supportedInterfaces &&

handlerInput.requestEnvelope.context.System.device.supportedInterfaces.hasOwnProperty('Alexa.Presentation.APL');

return result;

}

Is this setup actually supported? I'd like to know before I get myself an Echo show to troubleshoot this. I understand that APL cannot be tested in the developer console, correct?


aplaudioplayernodejs
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

Jason@Amazon avatar image
Jason@Amazon answered

The AudioPlayer interface cannot be used with other interfaces, which includes APL - it uses the Alexa platform to play and control music, meaning that when you use the AudioPlayer interface, your skill's session is no longer open.

APL can be tested in the developer console, while AudioPlayer directives cannot.

10 |5000

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