Skip to content

Instantly share code, notes, and snippets.

@isann
Last active November 20, 2018 05:41
Show Gist options
  • Save isann/e93e0b0d1a1976e7356dbbc550d928b3 to your computer and use it in GitHub Desktop.
Save isann/e93e0b0d1a1976e7356dbbc550d928b3 to your computer and use it in GitHub Desktop.
Alexa Presentation Language で Pager を自動スライドする ref: https://qiita.com/isann_tech/items/8ef507af808dff9fa22b
return handlerInput.responseBuilder
.speak('Hello APL.')
.reprompt('Hello APL.')
.addDirective({
"type" : "Alexa.Presentation.APL.RenderDocument",
"token" : "token",
"document" : {
"type" : "APL",
"version" : "1.0",
"theme" : "dark",
"import" : [],
"resources" : [],
"styles" : {},
"layouts" : {},
"mainTemplate": {
"item": [
{
"type" : "Container",
"alignItems" : "center",
"direction" : "column",
"justifyContent": "center",
"item" : [
{
"type" : "Image",
"source": "https://zono-img.appspot.com/480x480/00BFFF.jpg",
"width" : "480",
"height": "480"
}
]
}
]
}
}
}
)
.getResponse();
return handlerInput.responseBuilder
.speak('Hello APL.')
.reprompt('Hello APL.')
.addDirective(
{
"type" : "Alexa.Presentation.APL.RenderDocument",
"token" : "token",
"document": {
"type" : "APL",
"version" : "1.0",
"theme" : "dark",
"import" : [],
"resources" : [],
"styles" : {},
"layouts" : {},
"mainTemplate": {
"item": [
{
"type" : "Container",
"alignItems" : "center",
"direction" : "column",
"justifyContent": "center",
"item" : [
{
"type" : "Pager",
"width" : "480",
"height" : "480",
"textAlignVertical": "center",
"textAlign" : "center",
"navigation" : "normal",
"initialPage" : 0,
"id" : "foobar",
"item" : [
{
"type" : "Image",
"source": "https://zono-img.appspot.com/480x480/0033FF.jpg",
"width" : "480",
"height": "480"
},
{
"type" : "Image",
"source": "https://zono-img.appspot.com/480x480/00BFFF.jpg",
"width" : "480",
"height": "480"
},
{
"type" : "Image",
"source": "https://zono-img.appspot.com/480x480/FFBFFF.jpg",
"width" : "480",
"height": "480"
}
]
}
]
}
]
}
}
}
)
.addDirective(
{
"type" : "Alexa.Presentation.APL.ExecuteCommands",
"token" : "token",
"commands": [
{
"type" : "AutoPage",
"componentId": "foobar",
"duration" : 3000
}
]
}
)
.getResponse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment