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

146
Views
Llamar a la función Async dentro de la función Web Speech API

Estoy tratando de obtener el texto del audio usando Web Speech API, pasar ese texto a la llamada API y mostrar el resultado con textarea. Cada función funciona bien cuando se llama por separado. Pero una vez que traté de conectarlos, el área de texto no muestra nada.

 <button id="start-recording" onclick="recognition.start()">Start</button> <textarea id="results"></textarea>
 <script type="text/javascript"> const recognition = new webkitSpeechRecognition(); const resultpreview = document.getElementById("results"); recognition.onresult = function (event) { if (event.results.length > 0) { const text = event.results[0][0].transcript; callAPI(text); } }; const callAPI = async (text) => { var requestJson = { access_key: access_key, argument: { text: text, analysis_code: analysisCode, }, }; const response = await fetch(myURL, { method: "POST", body: JSON.stringify(requestJson), headers: { "Content-Type": "application/json; charset=UTF-8" }, }); const myJson = await response.json(); const words = myJson.return_object.sentence[0].NE; for (const word of words) { resultpreview.innerHTML += word.text; } }; </script>
about 4 years ago · Juan Pablo Isaza
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!