我正在尝试在Alexa讲话时渲染Alexa Presentation Language文档。我尝试使用具有多个页面的分页器和AutoPager命令。我要解决的问题是,在Alexa开始讲话时呈现文档,但在讲话结束时启动命令,并且我希望看到讲话时三页都在移动。 我正在使用RenderDocumet和executeCommand以及responseBuilder的语音指令。
文档模板: PagerDoc —>
{
"type": "APL",
"version": "1.0",
"theme": "dark",
"import": [],
"resources": [],
"styles": {},
"layouts": {},
"mainTemplate": {
"parameters": [
"datasource"
],
"item": [{
"type": "Container",
"items": [
{
"type": "Sequence",
"id": "pagerComponentId",
"scrollDirection": "vertical",
"numbered": true,
"width": "100vw",
"height": "100vh",
"alignItems": "center",
"justifyContent": "center",
"direction": "column",
"items": [
{
"type": "Image",
"source": "${datasource.app.properties.images.robot1}",
"position": "relative",
"width": "100vw",
"height": "100vh"
},
{
"type": "Image",
"source": "${datasource.app.properties.images.robot2}",
"position": "relative",
"width": "100vw",
"height": "100vh"
}
]
}
]
}
]
}
}
和指令:
var response = handlerInput.responseBuilder;
return response
.addDirective({
type : 'Alexa.Presentation.APL.RenderDocument',
token: 'pagerToken',
document : pagerDoc,
datasources : {
"app": {
"properties": {
"images": {
"robot1": "https://xxx/robot1.png",
"robot2": "https://xxx/robot2.png"
}
}
}
}
})
.addDirective({
type: 'Alexa.Presentation.APL.ExecuteCommands',
token: 'pagerToken',
commands: [
{
"type": "Parallel",
"commands": [
{
"type": "Scroll",
"componentId": "pagerComponentId",
"distance": 1
}
]
})
.speak(speechOutput)
.reprompt(repromptOutput)
.getResponse();
有人可以告诉我该怎么办吗? Alexa是否有可能? 在此先感谢您,并致以最诚挚的问候, 费尔南多
答案 0 :(得分:0)
这还不可能。如果您等到APL 1.1发行(即将推出)
APL 1.1会将onMount
添加到APL文档中,该文档应允许在文档加载后立即执行命令(例如,在alexa发言之前)