HTML5 Web Speech API not working locally

ぐ巨炮叔叔 提交于 2019-12-04 07:20:36
Code Uniquely

You could try adding the following snippet to see what error is being generated.

recognition.onerror = function(event) {
    console.log(event.error);
};

Chances are its spitting out a 'not-allowed' which generally means that the user agent is not allowing any speech input to occur for reasons of security, privacy or user preference (as you're running it locally through a file:// )

Have you tried serving the page under a local Web Server such as (IIS or Node) ?

Detailed discussion why camera (and microphone are not working on localhost here):

How to allow Chrome to access my camera on localhost?

In short, it is explicitly blocked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!