mounted() {
window.SpeechRecognition = window.webkitSpeechRecognition ||
window.SpeechRecognition;
let finalTranscript = "";
let recognition = new window.SpeechRecognition();
recognition.interimResults = true;
recognition.maxAlternatives = 10;
recognition.continuous = true;
recognition.onresult = event => {
let interimTranscript = "";
for (
let i = event.resultIndex, len = event.results.length;
i < len;
i++
) {
let transcript = event.results[i][0].transcript;
if (event.results[i].isFinal) {
finalTranscript += transcript;
} else {
interimTranscript += transcript;
}
}
console.log(finalTranscript + interimTranscript);
};
recognition.start();
}
cant get web speech API to work in my electron app, same code works well in the browser. Any possible reasons? I am using vue js with electron and the speech part is called when a component mounts.