webkitspeechrecognition 不再提示许可 [英] webkitspeechrecognition no longer prompts for permission

查看:36
本文介绍了webkitspeechrecognition 不再提示许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在设计一些使用 webkitspeechrecognition 的页面.我很快了解到您无法从文件中加载这些内容,您必须从网络服务器上提供它们.我正在使用 osx,所以我只是将我的文件移动到已经运行并启用的本地 apache.这在很长一段时间内都运行良好.

I've been prototyping a few pages that use webkitspeechrecognition. I learned quickly that you cannot load these from a file, you have to serve them from a webserver. I'm using osx so I just moved my files to the local apache that was already running and enabled. This worked fine for quite a while.

出于某种原因,我运行良好的页面都不会提示我拒绝/允许使用麦克风.我什至从另一个网络服务器复制了一个现有的工作页面,如果我从 http://localhost/speech.html 加载它它不会提示.它跳过提示并转到我的knowledge.onerror 处理程序并记录不允许"

For some reason, none of my pages that were working fine will prompt me to deny/allow the microphone usage. I even copied an existing working page from another webserver and if I load it from http://localhost/speech.html it will not prompt. It skips the prompt and goes to my recognition.onerror handler and logs "not-allowed"

但是,如果我从 http://127.0.0.1 加载相同的页面(或我的任何其他原型)/speech.html 它工作正常.这让我觉得我不小心缓存了诸如始终拒绝"之类的响应.我想我清除/重置了我的所有 chrome 设置,但我仍然得到相同的行为.127.0.0.1会正常提示,但是localhost根本不提示.

However, if I load the same page (or any of my other prototypes) from http://127.0.0.1/speech.html it works fine. This made me think I had accidentally cached a response like "always deny" or something. I think I cleared/reset all my chrome settings but I'm still getting the same behavior. 127.0.0.1 will properly prompt, but localhost will not prompt at all.

chrome 可能会在哪里存储一些我需要清除的其他设置?

Where might chrome be storing some additional settings that I need to clear?

推荐答案

目前在 chrome 中请求 getUserMedia 权限的工作方式如下:

getUserMedia permissions requesting in chrome currently works something like:

  • 如果您有 http 请求,getUserMedia 将只记住该会话的权限.如果您返回同一页面.它又问了一遍.
  • 如果您通过 https 执行相同的请求,则一旦设置了权限,您就始终拥有权限.
  • 我的记忆是,出于调试目的,为 http://localhost/... 授予了一个例外.在这种情况下,您不需要重复授予权限.
  • 如果您使用 http 和 127.0.0.1/,我认为也不例外.
  • If you have a request by http, getUserMedia will only remember the permissions for that session. If you go back to the same page. it asks again.
  • If you do the same request by https, once you set the permissions, you always have permissions.
  • My memory is that an exception is granted for http://localhost/... for debugging purposes. In this case, you don't need to repeatedly grant permissions.
  • If you use http and 127.0.0.1/, I think no exception is made.

http://www.html5rocks.com/en/tutorials/getusermedia/intro/

这篇关于webkitspeechrecognition 不再提示许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆