Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Unexpected End Of Input Using Microphone

I am using SpeechRecognition to use the microphone in one of my programs.

The Chrome Console is saying at the end: Unexpected end of input

    const speechRecognition =
window.webkitSpeechRecognition /*Chrome*/ ||
window.SpeechRecognition;/*Firefox...*/

function startListening() {
const recog = new speechRecognition
recog.start();
recog.onstart = console.log("Started Listening..");

recog.onresult = function (data) { 
handleResults(data);
};
//'data' comes from 'onresult'

function handleResults(data) {
let text = data.result[0][0].transcript;
console.log(text);
}

// Call Function On Load

window.addEventListener('DOMContentLoaded', startListening());
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you get the unexpected end of input error because you are not closing the startListening function correctly

function startListening() {
  const recog = new speechRecognition
  recog.start();
  recog.onstart = console.log("Started Listening..");

  recog.onresult = function (data) { 
    handleResults(data);
  }
} // <-- this is missing in your code
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!