Question

I'm trying to use the node webkit speech recognition API but it gives me a strange behavior. I initialize the recorder like that :

var rec = new webkitSpeechRecognition();
rec.continuous = true;
rec.interimResults = true;
rec.onresult = function(e){ alert('result') };
rec.onstart = function(e){ alert('start') };
rec.onerror = function(e){ console.log(e); };
rec.onend  = function(e){ alert('end') };
rec.onspeechstart = function(e){ alert('speechStart') };
rec.start();

But nothing occurs after start() call. The only slot which works is end() and I can't figure out this one works and not the other ones... What am I loosing ?

I browse this Github issue (webkitSpeechRecognition for desktop apps?) but don't find any useful information.

Était-ce utile?

La solution

webkitSpeechRecognition needs a back-end speech recognition system.

Chrome may use Google's speech recognition system. So we can use webkitSpeechRecognition on Chrome without any hassle. But on others even though it is based on webkit, It may not work properly.

I think it's difficult to use speech recognition feature on node-webkit before supporting Google's or someone's engine.

Also CHANGELOG 0.8.0 / 10-30-2013 says

- undefine window.webkitSpeechRecognition before it's supported

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top