Using getUSerMedia AND webkitSpeechRecognition all

2019-06-06 00: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!

pop-up access

navigator.getUserMedia({audio:true}, gotStream, function(e) {
    alert('Error getting audio');
    console.log(e);
});

and...

var recognition = new webkitSpeechRecognition();

2条回答
来,给爷笑一个
2楼-- · 2019-06-06 01:08

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

查看更多
狗以群分
3楼-- · 2019-06-06 01:15

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.

查看更多
登录 后发表回答