我有一个Alexa技能,我想在发布时播放一首歌。我正在使用VS2017与AWS Toolkit和AWS Lambda函数。我已经配置并构建了我的Alexa技能并发布了我的Lambda函数,并通过Alexa控制台测试和我的Alexa Echo验证了所有这些功能。
当我从我的SkillResponse中的返回文本更改为使用AudioPlayerPlay(来自Alex.NET Nuget包)返回音频指令时,我得到了看似格式正确且正确的JSON,但是Alexa控制台测试说它是一个不受支持的设备,我的Alexa Echo什么也没做。
这是AWS Lambda测试中的JSON。
{
"version": "1.0",
"response": {
"shouldEndSession": true,
"directives": [
{
"playBehavior": "REPLACE_ALL",
"audioItem": {
"stream": {
"url": "https://music.amazon.com/my/albums/You+Get+What+You+Give/YOU+GET+WHAT+YOU+GIVE/ZAC+BROWN+BAND?ie=UTF8&albumAsin=B00438BTJ6&playNow=1&trackAsin=B004386MMU",
"token": "scrumstartsong",
"expectedPreviousToken": null,
"offsetInMilliseconds": 0
}
},
"type": "AudioPlayer.Play"
}
]
}
}
这是Alexa控制台测试指令的条目:AudioPlayer.Play命令
{
"header": {
"namespace": "AudioPlayer",
"name": "Play",
"messageId": "d0c18d3c-2403-4f56-a059-67f3855f4e47",
"dialogRequestId": "0bae3b83-21f6-47a3-ae7c-b13b9487e60e"
},
"payload": {
"audioItem": {
"audioItemId": "amzn1.as-ct.v1.ThirdPartySdkSpeechlet#ACRI#url#ACRI#{\"directedCustomerId\":\"amzn1.ask.account.AHGMQILIBZCL6YKVYSGTEOJGJ2B7I3FUTXBL7AZWBULBPMOA4CGW7JBRTO7AZXAWVLVDLEB4EP3XRPOZXAUVA64I66QCHGSZ5A3OK4GHP4TR6BOJVAEKXVGD7NTASS6AYD5RDCBS4JS3SH7EFGYBWS34F7TC7GFMDOWRICBA6EYYKISCVKURCUMFTSXXWZDXUVE7NG336KWDJHY\",\"modelKey\":\"amzn1.ask.skill.8e374b1d-05d8-4455-afc5-d701aed22b7d\",\"obfuscatedCustomerId\":\"A2JSZ6NNUSHRJJ\",\"token\":\"scrumstartsong\"}",
"stream": {
"offsetInMilliseconds": 0,
"expiryTime": "2019-03-11T19:47:01+0000",
"url": "https://music.amazon.com/my/albums/You+Get+What+You+Give/YOU+GET+WHAT+YOU+GIVE/ZAC+BROWN+BAND?ie=UTF8&albumAsin=B00438BTJ6&playNow=1&trackAsin=B004386MMU",
"token": "amzn1.as-ct.v1.ThirdPartySdkSpeechlet#ACRI#url#ACRI#{\"directedCustomerId\":\"amzn1.ask.account.AHGMQILIBZCL6YKVYSGTEOJGJ2B7I3FUTXBL7AZWBULBPMOA4CGW7JBRTO7AZXAWVLVDLEB4EP3XRPOZXAUVA64I66QCHGSZ5A3OK4GHP4TR6BOJVAEKXVGD7NTASS6AYD5RDCBS4JS3SH7EFGYBWS34F7TC7GFMDOWRICBA6EYYKISCVKURCUMFTSXXWZDXUVE7NG336KWDJHY\",\"modelKey\":\"amzn1.ask.skill.8e374b1d-05d8-4455-afc5-d701aed22b7d\",\"obfuscatedCustomerId\":\"A2JSZ6NNUSHRJJ\",\"token\":\"scrumstartsong\"}"
}
},
"playBehavior": "REPLACE_ALL"
}
}
我为令牌尝试了不同的(和没有)值。
我已经通过让Alexa播放它来验证我可以访问我的Echo上的歌曲。
答案 0 :(得分:0)
我的感觉是您的代码没有问题!我公平地说,Alexa开发者控制台模拟器不支持Audio Player指令:(
记录在https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#requests:
另请参阅我的观点:Alexa Skill AudioPlayer: Console test Support poor support/bugs