使用 Node.js SDK 创建自定义响应对象
Create custom response object with Node.js SDK
我正在使用 node.js SDK 为 Echo Show 构建技能。我想使用 VideoApp 功能 (documentation) 根据我从用户那里获取的信息显示视频。我在 S3 中有视频,构建了指令和整个响应对象,并像这样调用 "response ready":
var directive = [
{
"type": "VideoApp.Launch",
"videoItem": {
"source": "https://s3.amazonaws.com/path/to/video.mp4",
"metadata": {
"title": "Video Title",
"subtitle": "Subtitle to video"
}
}
}
];
this.handler.response = buildResponse(directive);
this.emit(':responseReady');
我希望 Echo Show 使用我生成的响应对象来显示我的视频,但它却显示 "there was a problem with the requested skill's response." 当它显示时它还在角落显示 "Invalid directive"。以下是我生成的完整响应对象,如有任何关于如何正确启动视频的帮助,我们将不胜感激!
{
"version": "1.0",
"response": {
"shouldEndSession": true,
"outputSpeech": null,
"reprompt": null,
"directives": [
{
"type": "VideoApp.Launch",
"videoItem": {
"source": "https://s3.amazonaws.com/path/to/video.mp4",
"metadata": {
"title": "Video title",
"subtitle": "Subtitle to video"
}
}
}
],
"card": null
}
}
我想通了。我只需要制作视频及其所在的存储桶,在 S3 权限下公开可读。
我还发现,如果 VideoApp.Launch 指令中包含 shouldEndSession 属性,您会收到无效响应。
我正在使用 node.js SDK 为 Echo Show 构建技能。我想使用 VideoApp 功能 (documentation) 根据我从用户那里获取的信息显示视频。我在 S3 中有视频,构建了指令和整个响应对象,并像这样调用 "response ready":
var directive = [
{
"type": "VideoApp.Launch",
"videoItem": {
"source": "https://s3.amazonaws.com/path/to/video.mp4",
"metadata": {
"title": "Video Title",
"subtitle": "Subtitle to video"
}
}
}
];
this.handler.response = buildResponse(directive);
this.emit(':responseReady');
我希望 Echo Show 使用我生成的响应对象来显示我的视频,但它却显示 "there was a problem with the requested skill's response." 当它显示时它还在角落显示 "Invalid directive"。以下是我生成的完整响应对象,如有任何关于如何正确启动视频的帮助,我们将不胜感激!
{
"version": "1.0",
"response": {
"shouldEndSession": true,
"outputSpeech": null,
"reprompt": null,
"directives": [
{
"type": "VideoApp.Launch",
"videoItem": {
"source": "https://s3.amazonaws.com/path/to/video.mp4",
"metadata": {
"title": "Video title",
"subtitle": "Subtitle to video"
}
}
}
],
"card": null
}
}
我想通了。我只需要制作视频及其所在的存储桶,在 S3 权限下公开可读。
我还发现,如果 VideoApp.Launch 指令中包含 shouldEndSession 属性,您会收到无效响应。