Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cognitive Speech Services sample throws a runtime error in Chrome #1848

Closed
corinagum opened this issue Mar 26, 2019 · 11 comments
Closed

Cognitive Speech Services sample throws a runtime error in Chrome #1848

corinagum opened this issue Mar 26, 2019 · 11 comments
Assignees
Labels
area-speech bug Indicates an unexpected problem or an unintended behavior. front-burner p1 Painful if we don't fix, won't block releasing Sample Implement PoC or sample code

Comments

@corinagum
Copy link
Contributor

corinagum commented Mar 26, 2019

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:

@corinagum corinagum added bug Indicates an unexpected problem or an unintended behavior. front-burner Triage-E needs-repro Waiting for repro or investigation labels Mar 26, 2019
@xiaolangxyz
Copy link

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

@compulim
Copy link
Contributor

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

@compulim compulim added 4.5 p1 Painful if we don't fix, won't block releasing and removed needs-repro Waiting for repro or investigation Pending labels Apr 1, 2019
@corinagum corinagum added the Sample Implement PoC or sample code label Apr 1, 2019
@compulim
Copy link
Contributor

compulim commented Apr 1, 2019

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.

@corinagum corinagum added backlog Out of scope for the current iteration but it will be evaluated in a future release. and removed 4.5 labels Apr 2, 2019
@corinagum corinagum added Approved and removed backlog Out of scope for the current iteration but it will be evaluated in a future release. labels May 13, 2019
@corinagum corinagum added the 4.5 label May 20, 2019
@compulim
Copy link
Contributor

Maybe Chrome updated the error message.

image

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

@corinagum
Copy link
Contributor Author

@compulim are we reassigning this one to you?

@compulim compulim assigned compulim and unassigned corinagum May 22, 2019
@compulim
Copy link
Contributor

Took this now.

@compulim
Copy link
Contributor

compulim commented May 25, 2019

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>

@compulim compulim assigned corinagum and unassigned compulim Jun 12, 2019
@compulim
Copy link
Contributor

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

@corinagum
Copy link
Contributor Author

corinagum commented Jun 13, 2019

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.

@alokraj68
Copy link

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?

@corinagum
Copy link
Contributor Author

@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. #2469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-speech bug Indicates an unexpected problem or an unintended behavior. front-burner p1 Painful if we don't fix, won't block releasing Sample Implement PoC or sample code
Projects
None yet
Development

No branches or pull requests

4 participants