Botframework-webchat: Cognitive Speech Services sample throws a runtime error in Chrome

Created on 27 Mar 2019  路  11Comments  路  Source: microsoft/BotFramework-WebChat

I was unable to reproduce this issue in Edge or Firefox

Reproductions steps:

  1. Navigate to 06.c.cognitive-services-speech-services-js in Chrome version 73.0.3683.86
  2. Open console
  3. Press microphone button and say 'Help'
  4. Notice console errors regarding AudioNode, pasted below

image

We are still investigating the cause of this bug. Please feel free to add a +1 and the details of your experience to this issue.

Notes:

Speech Bug P1 Sample front-burner

All 11 comments

In my case, it is the error as the image below
error

@xiaolangxyz looks like your problem is related to #1823.

On the other hand, https://webchat-playground.azurewebsites.net/ works, while 06.c also fails on my box. Both of them connect to Cognitive Service.

Maybe Chrome updated the error message.

image

Connecting nodes after the context has been closed is not useful.

@compulim are we reassigning this one to you?

Took this now.

Today, we have a workaround for this particular Chrome bug:

  1. Speak an utterance
  2. Cancel in the midway
  3. Speak another utterance

Expected: speaking is falsy, then turn to truthy, then receive "start" event, and audio is played
Actual: speaking is falsy, then turn to truthy (which is wrong), but receive no "start" event, and no audio is played

Our workaround is, if we did not receive "start" event within a second, we will cancel and restart, up to 2 times.

Since this workaround applies to both Chrome and non-Chrome (Cognitive Services), thus, if Cognitive Services took more than 1 second to fetch/decode the audio, we would think it is bugged and we restart it. Leading to some long text to fail synthesizing.

I tested Chrome 74 and Edge "Anaheim" 76 and seems this bug no longer repro. Will try more browsers and if still not repro-ing, will remove this workaround. And next time, we shouldn't applies a workaround too broad, we should limit the workaround by building a new polyfill instead.

I am using the HTML below, then repetitively click "Speak" and "Cancel" button.

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <title>Speech</title>
  </head>
  <body>
    <button class="speak">Speak</button>
    <button class="cancel">Cancel</button>
    <p class="pending">Pending: <span class="value"></span></p>
    <p class="speaking">Speaking: <span class="value"></span></p>
    <script>
      document.querySelector('button.speak').addEventListener('click', () => {
        speechSynthesis.speak(new SpeechSynthesisUtterance('A quick brown fox jumped over the lazy dogs.'));
      });

      document.querySelector('button.cancel').addEventListener('click', () => {
        speechSynthesis.cancel();
      });

      setInterval(() => {
        document.querySelector('.pending > .value').innerHTML = speechSynthesis.pending + '';
        document.querySelector('.speaking > .value').innerHTML = speechSynthesis.speaking + '';
      }, 100);
    </script>
  </body>
</html>

In order to verify the fix:

  1. Ask the bot to synthesize a very long text that took > 1s to download the MP3 file from Cognitive Services
  2. Verify F12 that we don't see the "audio node is disconnected" error nomatter how long the text is

Fix is verified in #2035. It will be officially released for 4.5 in July. If you need this fix immediately, please build master into a locally hosted version of Web Chat.

Hi, I am still getting this same issue in chrome 77.

Also, after this, the speech recognizer is not starting.

I am manually canceling the voice since I need to stop it once user presses a button, after that this issue is happening.

Is it a known bug?

@alokraj68 Thank you for bringing this to our attention. I am going to file another issue since this appears to be a slightly different bug. https://github.com/microsoft/BotFramework-WebChat/issues/2469

Was this page helpful?
0 / 5 - 0 ratings

Related issues

electrobabe picture electrobabe  路  4Comments

joshm998 picture joshm998  路  3Comments

Stardox picture Stardox  路  3Comments

AndreMantas picture AndreMantas  路  4Comments

compulim picture compulim  路  3Comments