I have a chatbot which runs in electron and I need to add speech to text there. I used window.SpeechRecognition and window.webkitSpeechRecognition but it seems now chrome is not supporting to speech recognition in electron. Is there a way that I can enable speech to text in electron. Below is my code which I've tried.
function listen() {
let mic = document.getElementById('mic');
mic.style.color = 'red';
mic.className = 'animated pulse infinite';
let SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var hear = new SpeechRecognition();
hear.continuous = false;
hear.lang = 'en-IN';
hear.start();
hear.onresult = function (e) {
mic.style.color = 'black';
mic.className = '';
userVoiceText = e.results[0][0].transcript;
hear.stop();
createSender(userVoiceText);
respond(userVoiceText);
}
}
This is a must need requirement for my app. Suggestions for any workaround or API is appreciated.