Using getUSerMedia AND webkitSpeechRecognition allow access x 2

懵懂的女人 提交于 2019-12-08 08:28:25

问题


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();

回答1:


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.




回答2:


On Chrome 36 (and possibly earlier ones) I'm getting just one popup bar for both.



来源:https://stackoverflow.com/questions/21852846/using-getusermedia-and-webkitspeechrecognition-allow-access-x-2

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