javascript - Echo Show 10 上的 Alexa HTML Web API“Alexa.create not a function”错误
问题描述
这是我的 Alexa Skill 的 HTML 代码。
<head>
<script src="https://cdn.html.games.alexa.a2z.com/alexa-html/latest/alexa-html.js">
</script >
</head>
<body>
var alexaClient;
Alexa.create({version: '1.0'})
.then((args) => {
const {
alexa,
message
} = args;
alexaClient = alexa;
document.getElementById('debugElement').innerHTML = 'Alexa is ready :)';
})
.catch(error => {
document.getElementById('debugElement').innerHTML = 'Alexa not ready :(';
});
</body>
在 Echo Show 8 和 Echo Show 5 上工作正常,但 Echo Show 10 对相同的代码给出错误。它说“Alexa.create 不是函数”。可能的错误是什么?
'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'0.2'}
这是 Echo Show 10 的请求 Echo Show 8 提供 1.1 版
这可能是问题吗?
解决方案
在亚马逊文档中是这样的:
"device": {
"deviceId": "amzn1.ask.device.XXXX",
"supportedInterfaces": {
"Alexa.Presentation.HTML": {
"runtime": {
"maxVersion": "1.0"
}
},
"Alexa.Presentation.APL": {
"runtime": {
"maxVersion": "1.4"
}
}
}
}
maxVersion 为 1.0,因此它可能支持 create 功能,但 echo show 10 具有 maxVersion 0.2,因此它可能不支持或不具有 create 功能。我还不知道具体情况。
你能改变吗
'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'0.2'}
至
'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'1.0'}
? 假设您使用的是虚拟环境而不是真实设备。
您可能需要查看Alexa HTML SDK网站。
推荐阅读
- sqlite - SQLite 中的本地日期
- python - Python Selenium - 如何单击 AJAX 按钮?(硒没有找到 XPath)
- javascript - 顶部菜单和 2 列表格的 CSS 帮助
- node.js - npm 不会使用 Laravel/Homestead 安装 package.json 文件中列出的软件包
- php - 不存在关系时的默认值
- python - 合并最后一个字母在python中重复的txt文件
- google-maps - 谷歌地图 URL 中的缩放控件
- sql - 内部联接中 AS 中的 SQL 选择
- python - 机器人框架预期错误失败:IndexError:列表索引超出范围
- php - 使用 PHP 执行远程 .bat 文件的最佳方法