1

I am adding voice input to a web app using webkitSpeechRecognition (https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#dfn-onspeechstart).

This popup asking for permission to use mic appears each time I initiate recognition.start(); (recognition = new webkitSpeechRecognition()) :

enter image description here

The users will need to use the mic several times throughout the life of the app, and I only want them to have to give their permission once.

How can I just have it show initially on web app load?

user3871
  • 12,432
  • 33
  • 128
  • 268
  • the answer in this thread is good for you: http://stackoverflow.com/questions/15993581/reprompt-for-permissions-with-getusermedia-after-initial-denial – Saar Oct 11 '15 at 16:26

1 Answers1

-1

Using JQuery:

$(document).ready(function(){ recognition.start(); });

Using pure JS:

document.addEventListener("DOMContentLoaded", function(event) { recognition.start(); });

  • this will not stop the request of the permission – Saar Oct 11 '15 at 16:25
  • You can not activate the mic without the permission request. Waht you might be able to do is to keep in running in the background. And read out the data when you need it. This will however still prompt the user on loading the page. – Alec Meijerink Oct 12 '15 at 12:45