问题描述
我创建使用两种类型的音频输入... getUserMedia和webkitSpeechRecognition的网站。这两个功能都工作正常,但Chrome的两倍弹出它的访问安全弹出 - 这是有道理的。有谁知道如何有一个访问权限处理这两个功能?
干杯SO!
navigator.getUserMedia({音频:真正},gotStream,功能(E){
警报('错误获取音频');
的console.log(E);
});
和...
VAR识别=新webkitSpeechRecognition();
要避免询问权限多次的唯一方法是,以确保您的网页使用的是HTTPS URL。然后,Chrome会记住您的权限,而不是再次显示弹出。
I am creating a site that uses two types of audio input... getUserMedia and webkitSpeechRecognition. Both functions are working fine but Chrome is popping up it's access security pop-up twice - which makes sense. Does anyone know how to have one access permission handle both functions?
Cheers SO!
navigator.getUserMedia({audio:true}, gotStream, function(e) {
alert('Error getting audio');
console.log(e);
});
and...
var recognition = new webkitSpeechRecognition();
The only way to avoid asking for permissions multiple times is to make sure that your web page is using the https url. Then Chrome will remember your permissions and not show the pop-up again.
这篇关于使用getUSerMedia和webkitSpeechRecognition允许访问×2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!