How to use the botframework-webchat.createCognitiveServicesBingSpeechPonyfillFactory function in botframework-webchat

To help you get started, we’ve selected a few botframework-webchat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-WebChat / packages / playground / src / App.js View on Github external
useEffect(() => {
    if (speech === 'bingspeech') {
      createCognitiveServicesBingSpeechPonyfillFactory({
        authorizationToken: () => fetchAndMemoizeBingSpeechAuthorizationToken(Date.now())
      }).then(webSpeechPonyfillFactory => setWebSpeechPonyfillFactory(() => webSpeechPonyfillFactory));
    } else if (speech === 'speechservices') {
      const webSpeechPonyfillFactory = createCognitiveServicesSpeechServicesPonyfillFactory({
        authorizationToken: () => fetchAndMemoizeSpeechServicesAuthorizationToken(Date.now()),
        region: 'westus2'
      });

      setWebSpeechPonyfillFactory(() => webSpeechPonyfillFactory);
    } else {
      setWebSpeechPonyfillFactory(() => createBrowserWebSpeechPonyfillFactory());
    }
  }, [speech, setWebSpeechPonyfillFactory]);