web Speech Listener

Asked

Viewed 27 times

0

I have the following programming. She writes input to text4 and text5 by the corresponding button.

However, I wanted to do it automatically, that is, when I start input, via text4, the listen4() function itself would open MIC5 as the button does. After all in this function I call the function listen5(). But this does not happen. I need help with this.

<button class="btn" onclick="listen4()">MIC
4:</button>
<input id="text4">
..............................
<button class="btn" onclick="listen5()">MIC
5:</button>
<input id="text5">
........................
function listen4() {
listener.listen("pt", function(text4) {
document.getElementById("text4").value = text4 ; nota4 = document.getElementById("text4").value; speaker.speak("pt", nota4);listen5();})}
..................................................

function listen5() {
listener.listen("pt", function(text4) {
document.getElementById("text5").value = text5 ; nota5 = document.getElementById("text5").value; speaker.speak("pt", nota5); })}
..................................................
  • 1

    Open the browser console and see if there was an error.

  • no error. What happens is that the listen5 function is only executed when I click the mic5 button. I wanted the mic4 button after executing the listen4 function, also to execute listen5. But it stops at the beginning of the listen5 function Listen. I know this because I put an Alert there.

  • If the script stops, it is because it gave an error. Did you ever look at the console and had nothing? Alert does not guarantee that it has not given any error.

  • Nothing comes up at all. I read somewhere that in order for Listener to work, without the button, you need to monitor the microphone to see if it has any changes. There must be some method to monitor the microphone.However, when I click on the button, it works, it just doesn’t work, when I invoke the function, without clicking on the button.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.