0

Web recognition In js

const btn = document.querySelector('talk') const content = document.querySelector('content') const SpeechRecognition = window.SpeechRecognition ||window.webkitSpeechRecognition; const recognition = new SpeechRecognition(); recognition.onstart = function () { console.log ('voice recognition active '); }; recognition.onresult = function (event) { const current = event.resultIndex; const transcript = event.results [current] [0].transcript; content.textContent = transcript; }; btn.addEventListener('click',() => { recognition.start(); }); Can ik what's wrong over here? It's not working :/

15th Feb 2021, 7:27 AM
Dhruv Gupta
Dhruv Gupta - avatar
1 ответ
0
Wish I could help, but I am not familiar with this API. I can of course recommend the old “human interpreter” method, in which you basically work your own way through the code line by line, and see if you come up with the same answer as the computer.
15th Feb 2021, 4:11 PM
Wilbur Jaywright
Wilbur Jaywright - avatar