question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable Text-To-Speech issue

See original GitHub issue

Edited by @compulim to add what we should fix.

Description

My customer would like to enable the Speech-To-Text feature, but not the Text-To-Speech one. I tried to set to null the properties speechSynthesis and SpeechSynthesisUtterance but it’s not working. This is my code:

var _botConnection = new window.WebChat.createDirectLine({
      token: '{secret}'
});    
const subscriptionKey = 'xxxxxxxxxxxxxx';

async function createPonyfillFactory() {
       const webSpeechPonyfillFactory = await window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory({
       region: 'westeurope',
       speechRecognitionEndpointId: 'yyyyyyyyyyyyy',
       subscriptionKey
       });
       
     return options => {
            const webSpeechPonyfill = webSpeechPonyfillFactory(options);
                    return {
                        SpeechGrammarList: webSpeechPonyfill.SpeechGrammarList,
                        SpeechRecognition: webSpeechPonyfill.SpeechRecognition,
                        speechSynthesis: null,
                        SpeechSynthesisUtterance: null
                    }
                };
            };

 window.WebChat.renderWebChat({
       directLine: _botConnection,
       webSpeechPonyfillFactory: await createPonyfillFactory()
       },
       document.getElementById('webchat')
 );

This is the console output:

_webchat.js:1 TypeError: i is not a constructor
    at c (webchat.js:1)
    at webchat.js:1
    at c (webchat.js:1)
    at Generator._invoke (webchat.js:1)
    at Generator.e.<computed> [as next] (webchat.js:1)
    at n (webchat.js:1)
    at s (webchat.js:1)
    at webchat.js:1
    at new Promise (<anonymous>)
    at webchat.js:1_

The first interaction works fine, but after it the microphone icon is greyed out and you cannot dictate anymore.

Could you please help me? Thanks

What we should fix

(Will update this from time to time)

Current error:

createContext.js:25 TypeError: SpeechSynthesisUtterance is not a constructor
    at createNativeUtterance (QueuedUtterance.js:14)
    at _callee4$ (QueuedUtterance.js:58)
    at tryCatch (runtime.js:45)
    at Generator.invoke [as _invoke] (runtime.js:271)
    at Generator.prototype.<computed> [as next] (runtime.js:97)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)
    at eval (asyncToGenerator.js:32)
    at new Promise (<anonymous>)
    at eval (asyncToGenerator.js:21)

We need to prevent synthesizing if it is null/falsy. So something up this call stack need to be blocked.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
compulimcommented, Sep 19, 2019

Got a fix in PR. 😄

1reaction
compulimcommented, Sep 18, 2019

/👀

(Looking at this now.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextToSpeech stop() not working - Stack Overflow
It is a common problem. @Override protected void onStop() { super.onStop(); if(tts != null){ tts.shutdown(); } }.
Read more >
How to Turn Off Google Text to Speech? - Folio3AI Blog
How to disable google text to speech on Windows? · Open the Settings · Click on “Interaction” on the right pane · Click...
Read more >
How to Disable or Enable Text to Speech - Republic Wireless
Objective. How to Disable or Enable Text to Speech. Environment. Moto X2; Moto G3; Android 5.1.1 Lollipop. Procedure. Tap Apps; Tap Settings; Tap...
Read more >
How to disable Text To Speech on Raspberry Pi?
Check to see if you have the Orca Screen reader installed (package name: orca). I think it gets installed automatically when a certain...
Read more >
Correcting a Samsung Device Text-to Speech Problem
Finally, change the preferred text-to speech engine to Google Text-to Speech. This should correct the system error and allow you to run ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found