Search code examples
google-chromespeech

Problems with Chrome Speech Input Events


I'm trying to use the Chrome speech input control. Basic operation is no problem, but I cannot get an event to fire after some speech is entered. Probably something stupid, but I can't see it.

Here's the html:

<input type="text" speech="speech" x-webkit-speech="x-webkit-speech"
           x-webkit-grammar="builtin:translate" id="inbNote"/>

I tried adding inline event handlers, to no avail. Then I tried a jQuery bind:

$('#inbNote').bind("onwebkitspeechchange", function(){alert($('#inbNote').val())});

I also tried "onspeechchange" as the event name. Neither does anything, as far as I can tell.

Also, everytime I click the microphone the little "speak now" bubble pops up. When I stop speaking, the contents of the bubble disappear, but the bubble itself remains displayed and on top. It will not close until I close Chrome completely. If I enter multiple speech inputs, I get multiple bubbles. Do I have some Chrome config problem? I'm using 18.0.1025.1 dev-m.


Solution

  • You must use 'webkitspeechchange' not 'onwebkitspeechchange':

    So, it would be:

    $('#inbNote').bind("webkitspeechchange", function(){alert($('#inbNote').val())});
    

    Good luck!