Speech and Teneo Web Chat

We currently don’t have a code example that exactly shows how to add support for the web speech api to the Teneo Web Chat, but you might find the attached speech.js file useful. We have used it in the past for demos that used the web speech api.

You would have to modify the code to your needs and embed into the Teneo Web Chat code yourself however. For example, the code makes use of jQuery constructs and refers to html fields and tags that were relevant for my demo, which you probably want to update.

To start the speech recognition, you might want to add an onclick handler to a mic button or icon that calls a method like such as:

function startASR () {
    try {
        console.log('starting speech recognition');
        if (recognizing) {
            recognition.abort();
            //console.log('recognition aborted');
            return;
        }
        final_transcript = '';
        recognition.lang = lang;
        recognition.start();
        ignore_onend = false;

    } catch (Exception) {
       console.log(`Speech Exception ${Exception}`);
    }
}
1 Like