How to use the botframework-webchat.createCognitiveServicesSpeechServicesPonyfillFactory 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-solutions / solutions / testharnesses / typescript / assistant-WebChat / packages / app / src / UI / Chat.js View on Github external
componentWillReceiveProps(nextProps) {
    if (nextProps.speechServicesOptions !== this.props.speechServicesOptions) {
      createCognitiveServicesSpeechServicesPonyfillFactory(nextProps.speechServicesOptions).then(speechServicesPonyfill => {
        this.setState(() => ({ speechServicesPonyfill }));
      });
    }
  }
github microsoft / BotFramework-WebChat / samples / 13.a.customization-speech-ui / src / App.js View on Github external
async componentDidMount() {
    const res = await fetch('https://webchat-mockbot.azurewebsites.net/directline/token', { method: 'POST' });
    const { token } = await res.json();
    const webSpeechPonyfillFactory = await createCognitiveServicesSpeechServicesPonyfillFactory({
      authorizationToken: fetchSpeechServicesToken,
      region: await fetchSpeechServicesRegion()
    });

    this.setState(() => ({
      directLine: createDirectLine({
        token
      }),
      webSpeechPonyfillFactory
    }));
  }
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]);