Javascript Annyang:如何从localhost使用它
我尝试从localhost运行一个html/javascript应用程序。该应用程序使用annyang语音控制工具,该工具在我的Win7电脑的Chrome浏览器中正常工作 网站()上的评论建议:- 对于那些想要在本地主机上运行它的人-不要使用类似于 “lokalhost/index.html”等使用类似IP的 chrome会要求您允许 你的麦克风 我试过哪种加载方式可以,但Chrome没有请求麦克风许可或响应语音命令 使用会出现“网页不可用”错误 有没有人对如何让它发挥作用有什么建议? (我不能在网站上聊天,因为我不使用facebook) 编辑1 以下是我的HTML页面中的相关代码(我美化了原来缩小的annyang.min.js) 编辑2Javascript Annyang:如何从localhost使用它,javascript,html,annyang,Javascript,Html,Annyang,我尝试从localhost运行一个html/javascript应用程序。该应用程序使用annyang语音控制工具,该工具在我的Win7电脑的Chrome浏览器中正常工作 网站()上的评论建议:- 对于那些想要在本地主机上运行它的人-不要使用类似于 “lokalhost/index.html”等使用类似IP的 chrome会要求您允许 你的麦克风 我试过哪种加载方式可以,但Chrome没有请求麦克风许可或响应语音命令 使用会出现“网页不可用”错误 有没有人对如何让它发挥作用有什么建议? (我不能
它可以使用URL:localhost/myFile.html或URL:127.0.0.1/myFile.html正常工作。但似乎不能有任何其他浏览器选项卡同时使用麦克风访问。Https可能有问题吗
似乎它可能需要https才能正常工作。如果您让它以1对1的方式工作,则似乎您忽略了URL的/web部分。您可以向我们显示本地html页面的内容吗?@dievardump。整个html文件非常大。编辑问题以显示相关代码。@Titus Popovici。我尝试了各种url排列。老实说,我并不真正理解:58604/web/.Aha的目的。现在它起作用了。谢谢你的建议。谢谢,但是没有。它现在可以在Chrome中使用。但它不适用于任何人https://....127.0.0.1/myFile.html 你是怎么这样跑的?
<script src="myFiles/js/annyang.js"></script>
function F_Init_Voice_Commands() //... using Annyang
{
//... annyang object is created in the annyang.js module.
if ( annyang )
{
//... Let's define our first command. First the text we expect ('Hello'), and then the function it should call (alert())
var commands =
{
'Hello': function()
{
alert ("Hello there!");
}
};
//.. Add our commands to annyang object
annyang.addCommands(commands);
//... Start listening. You can call this here, or attach this call to an event, button, etc.
annyang.start();
}
} //... EOF F_Init_Voice_Commands().