Ing*_*rid 3 alexa aws-lambda alexa-skills-kit
我编写了Alexa技能,该技能使用Lambda函数播放给定URL中的独特音频。
名为“ PlayAudio”的Intent正在运行,并播放我们JSON格式的API中的第一个音频项目。
名为“ PlaybackNearlyFinished”的Intent无法正常运行,也就是无法播放我正在馈送的音频文件。谁能确切解释为什么这行不通?
这是我的Lambda函数的一部分,其中包含两个Intent:
Fact.prototype.intentHandlers = {
"PlayAudio": function (event, context, response) {
fetchEnseParse("/latest", function(body) {
if(body == "error") {
}
else {
var directives = body.enses.map(function(ense) {
var a = ense[1].fileUrl;
return {
'playBehavior': 'REPLACE_ALL',
'audioItem':
{
'stream':
{
'url': 'https://s3.amazonaws.com/media.ense.nyc/enses/2017_01_13T16_57_20.190Z/30312/0',
'token': '33529',
'offsetInMilliseconds': 0
}
},
'type': 'AudioPlayer.Play'
};
})
}
var jsonresponse = {
'outputSpeech': {
'text': '',
'type': 'PlainText'
},
'directives': [directives[0]]
};
response.justUseThisJsonPlease( { response: jsonresponse } );
});
},
"AudioPlayer.PlaybackNearlyFinished" : function(event, context, response) {
var second =
{
"type": "AudioPlayer.Play",
"playBehavior": "REPLACE_ENQUEUED",
"audioItem": {
"stream": {
"url": "https://s3.amazonaws.com/media.ense.nyc/enses/violetindigoviolet/30034/0",
"token": "33530",
"offsetInMilliseconds": 0
}
}
}
response.justUseThisJsonPlease( { response: second } );
},
Run Code Online (Sandbox Code Playgroud)
似乎您的响应中包括outputSpeech。
对于此页面的常规意图而言,这是可以的,但对于AudioPlayer请求而言,这不是可以的:https: //developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference
看到确切的有效载荷也有帮助。您可以使用它在本地进行测试并获得以下内容:https : //bespoken.tools/blog/2016/08/24/introducing-bst-proxy-for-alexa-skill-development
您应该会看到来自Alexa的另一个请求SystemExceptionEncountered,该请求应该提供有关错误原因的更多信息。当对AudioPlayer请求的响应不正确时,它将发送此消息。
| 归档时间: |
|
| 查看次数: |
1135 次 |
| 最近记录: |