我正在开发一种Alexa技能,需要播放我将从自己的API获得的媒体。
根据documentation,我必须向Alexa发送要播放的媒体的网址:
{
"version": "1.0",
"sessionAttributes": {},
"response": {
"outputSpeech": {},
"card": {},
"reprompt": {},
"shouldEndSession": true,
"directives": [
{
"type": "AudioPlayer.Play",
"playBehavior": "ENQUEUE",
"audioItem": {
"stream": {
"url": "https://cdn.example.com/url-of-the-mp3-to-play/audiofile.mp3",
"token": "1234AAAABBBBCCCCCDDDDEEEEEFFFF",
"expectedPreviousToken": "9876ZZZZZZZYYYYYYYYYXXXXXXXXXXX",
"offsetInMilliseconds": 0
},
"metadata": {
"title": "My opinion: how could you diss-a-brie?",
"subtitle": "Vince Fontana",
"art": {
"sources": [
{
"url": "https://cdn.example.com/url-of-the-skill-image/brie-album-art.png"
}
]
},
"backgroundImage": {
"sources": [
{
"url": "https://cdn.example.com/url-of-the-skill-image/brie-background.png"
}
]
}
}
}
}
]
}
}
问题是:
我的API需要Authorization标头,而Alexa似乎只是获取我在url中传递的源,如何指示Alexa在请求中插入Authorization标头?
答案 0 :(得分:0)
与AWS Alexa团队联系后,他们澄清:
使用AudioPlayer播放的音频文件必须托管在端口443上的Internet可访问的HTTPS端点上-根据下面audioItem.stream.url上的文档,目前不支持授权: https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#play-params
因此,在此期间,我们不能使用需要授权的音频文件。