1

我已经工作了几天在我的 nodejs webkit 应用程序中实现语音识别,但它失败了。

我试图为它编写一个本地 html 文件演示,但它没有工作,所以我使用 apache 并将演示放在主机上,但仍然没有工作。然后我尝试使用 https 连接到我的本地主机,它确实适用于我的演示。问题是我不知道如何让我的 nodejs webkit 应用程序在 https 环境中运行。

请注意,我在演示中使用了 annyang 库,并从他们的站点复制了一个应该可以工作的示例。

在此先感谢您的帮助 :)

更新 1:按照 edwan 的正当要求,这是一个基本的简单示例来演示我的问题:

<script.         src="//cdnjs.cloudflare.com/ajax/libs/annyang/2.0.0/annyang.min.js"></script>
<script>
if (annyang) {
// Let's define our first command.           First the text we expect, and then the.   function it should call
 var commands = {
  'hello': function() {
    alert("you said hello");
   }
 };

// Add our commands to annyang
annyang.addCommands(commands);

// Start listening. You can call.   this here, or attach this call to an.   event, button, etc.
 annyang.start();
 }
</script>

如果您将此代码放在您的 nodejs webkit 环境中,它将无法工作。同样在本地 chrome 环境中或在带有 http 的主机上。只有在 https 它对我有用

4

0 回答 0