+ 13

Problem with speech recognition API in electron

I was trying to create a bot using speech recognition web api and it works totally fine in browser. But when I run the same in electron.. still no errors. Everything loads and runs properly... But when I call the recognition.start(), it automatically calls the recognition.stop() method :( I searched this problem on Google and found someone with similar problem but no solution :( https://stackoverflow.com/questions/62501348/why-speech-recognition-works-in-web-page-but-in-electron-not My code goes smth like this const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition var recognition = new SpeechRecognition(); document.body.onclick = function() { recognition.start(); console.log('listening...'); } recognition.onresult = (data) => { console.log(data) } recognition.onend = () => { console.log("end") recognition.start() } // No error in the console but it keeps logging "end"

9th Jan 2021, 1:00 PM
Shreyansh
Shreyansh - avatar
5 Respostas
+ 4
A. S. M. There must be some alternetive... I've tried the https://github.com/noffle/electron-speech But is says electron-spwan is undefined. Tho I've installed it properly and it's in my package.json file :( Also the code runs fine without any errors like SpeechRecognition is undefined or smth. But it runs perfectly fine. The only problem is that is automatically calls the recognition.stop() Everytime I call recognition.start() Calviղ Gordon Raj Chhatrala Burey plz help
9th Jan 2021, 4:29 PM
Shreyansh
Shreyansh - avatar
+ 4
try to activate the DevTool in electron app and see the version of browser Electron is using.
10th Jan 2021, 5:42 AM
Gordon
Gordon - avatar
+ 4
"You'll need to serve your code through a web server for recognition to work." source: caniuse https://caniuse.com/?search=SpeechRecognition%20API%3A%20onend
11th Jan 2021, 5:06 PM
Gordon
Gordon - avatar
+ 3
https://www.google.com/search?q=does+electron+supports+speech+recognition+api&oq=does+electron+supports+speech+recognition+api&aqs=chrome..69i57j33.30811j0j4&client=ms-android-coolpad&sourceid=chrome-mobile&ie=UTF-8 here, Sorry bro ☹
9th Jan 2021, 2:45 PM
ASM
ASM - avatar
+ 3
Gordon chrome: 78.0.3904.130 node: 12.8.1 electron: 7.2.4
10th Jan 2021, 1:16 PM
Shreyansh
Shreyansh - avatar