0

我正在尝试在 Alexa 讲话时呈现 Alexa 演示语言文档。我尝试使用带有多个页面的寻呼机和 AutoPager 命令。我要解决的问题是,当 Alexa 开始讲话时会呈现文档,但在讲话结束时会启动命令,并且我希望看到三个页面在讲话时移动。我正在使用 RenderDocumet、executeCommand 和 responseBuilder 的 speak 指令。

文档模板: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 可以做到这一点?非常感谢和最好的问候,费尔南多

4

1 回答 1

0

这还不可行。如果您等到 APL 1.1 发布(即将推出)APL 1.1 将添加onMount到 APL 文档中,该文档应允许在加载文档后立即执行命令(例如,在 alexa 说话之前)

于 2019-06-20T09:51:39.403 回答