Skip to content

Disable Text-To-Speech issue #2379

@enriconatella

Description

@enriconatella

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.

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.backlogOut of scope for the current iteration but it will be evaluated in a future release.bugIndicates an unexpected problem or an unintended behavior.customer-replied-toRequired for internal reporting. Do not delete.customer-reportedRequired for internal Azure reporting. Do not delete.front-burner

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions