mdn / browser-compat-data

This repository contains compatibility data for Web technologies as displayed on MDN
https://developer.mozilla.org
Creative Commons Zero v1.0 Universal
4.89k stars 1.97k forks source link

api.SpeechRecognition.continuous - false unsupported in Safari #19084

Open tsegreto opened 1 year ago

tsegreto commented 1 year ago

What type of issue is this?

Browser bug (a bug with a feature that may impact site compatibility)

What information was incorrect, unhelpful, or incomplete?

Safari does not honor SpeechRecognition.continuous being set to false. It does not stop listening after it stops. See my StackOverflow post: https://stackoverflow.com/questions/75498609/safari-webkitspeechrecognition-continuous-bug

What browsers does this problem apply to, if applicable?

No response

What did you expect to see?

Detailing this bug in Safari

Did you test this? If so, how?

Read: https://stackoverflow.com/questions/75498609/safari-webkitspeechrecognition-continuous-bug

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

https://stackoverflow.com/questions/75498609/safari-webkitspeechrecognition-continuous-bug

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/continuous

MDN metadata

MDN page report details * Query: `api.SpeechRecognition.continuous` * Report started: 2023-03-09T13:50:26.194Z
paulkernfeld commented 5 months ago

Oof, I ran into this as well. Thank you for your StackOverflow post.

Safari does seem to respond to the continuous flag; it only emits an end event when continuous is set to false. I tested on Safari 16.5.2 on MacOS 11.7.10.

Here's a standalone HTML file that reproduces the behavior that results are still emitted even though continuous has not been set (and so defaults to false).

<!DOCTYPE html>
<html>

<head>
  <title>Safari Speech Recognition Is Always Continuous</title>
</head>

<body>
  <p>Click anywhere to start speech recognition. The expected behavior is that the browser stops listening after the `end` event fires, but it seems that Safari continues to listen and return results.</p>
</body>

<script>
  document.onclick = async () => {
    const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
    const recognition = new SpeechRecognition();
    recognition.onend = (event) => {
      document.body.innerHTML += `<p>End</p>`;
    };
    recognition.onresult = (event) => {
      document.body.innerHTML += `<p>Result: ${event.results[event.results.length - 1][0].transcript}</p>`;
    };
    document.body.innerHTML = '<p>Listening...</p>';
    recognition.start();
  };
</script>

</html>