amazon-web-services - 从需要 Alexa 标头的外部来源播放媒体
问题描述
我正在开发一项 Alexa 技能,我需要播放从我自己的 API 获得的媒体。
根据文档,我必须向 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 标头?
解决方案
在与 AWS Alexa 团队联系后,他们澄清说:
要使用 AudioPlayer 播放的音频文件必须托管在端口 443 上可访问 Internet 的 HTTPS 端点上 - 根据以下 audioItem.stream.url 上的文档,目前不支持授权: https ://developer.amazon .com/docs/custom-skills/audioplayer-interface-reference.html#play-params
所以在此期间,我们不能使用需要授权的音频文件。
推荐阅读
- c++ - 这是什么:L"DLGCTRL_"L#dialog_control_id
- php - Yii2 在哪里存储机密/私人媒体文件(图像、视频)?
- wordpress - 来自 WordPress 站点的急切负载服务工作者
- typescript - 是否有没有写入 .js 的仅限 TypeScript 的注释?
- facebook - 是否可以通过 Facebook JS API 和 Facebook 对话框将图像发布到我的提要/墙上?
- typescript - Typescript:从实现中发出具有不同类型的声明文件?
- ajax - 使用 ajax 和谷歌翻译 API 翻译文本
- ios - 如何从枚举中检索值?
- c# - 在 ASP.net 中获取用户授权的所有控制器
- ansible - 如何在 Ansible 中遍历库存并分配价值