Support for the webkitSpeechRecognition API in Opera
Asked Answered
D

2

15

We're using the webkitSpeechRecognition API in Chrome. Since this is a prototype application, we're quite happy to support only Chrome, so we detect support for the API by doing a window.hasOwnProperty('webkitSpeechRecognition') check (as suggested by Google). This happily fails in Firefox, but the new Opera (being webkit-based) reports it does have the property. And, indeed, all code runs as intended, except... none of the events are ever fired, no voice is ever recorded.

So, my question is: can I make it work somehow? Does it require some special permissions or settings?

Alternatively, is there a way (aside good old browser-sniffing) to detect proper, working support for the webkitSpeechRecognition?

Damper answered 20/4, 2016 at 10:52 Comment(2)
Did you find an alternative to browser-sniffing? I am facing the very same problemPlumbago
@OscarHermosilla no, unfortunately. It wasn't critical to us, so I wasn't looking very actively. But I'm curious, let me just put up a bounty.Floristic
F
5

Right now only google chrome have API to speech recognition by stream (they have google sppeech API).

If you will use https://www.google.com/intl/en/chrome/demos/speech.html on Opera it will tell you that you need Chrome25+ to do this.

Acording to http://caniuse.com/#feat=speech-recognition Opera webkit have support for this functionality but right now it is not working. Opera does not have any API service that would translate it on the fly. Right now there have only placeholders function in their browser, maybe in the future they will make it, right no it is not working.

* EDITED *

Example by google how to determinte if it working or not.

// checking by google
if (!('webkitSpeechRecognition' in window)) {
  console.log('GOOGLE: not working on this browser');
} else {
  console.log('GOOGLE: working');
}

//your way
if (window.hasOwnProperty('webkitSpeechRecognition')) {
  console.log('YOUR: working');
} else {
  console.log('YOUR: not working on this browser');
}
Familist answered 14/12, 2016 at 15:46 Comment(6)
I'm using Opera build 41.0.2353.69, and the speech demo page just plain doesn't work, without telling me anything. And I chuckled how caniuse.com reports it as "partial support", same as Chrome. At any rate, is there a way to detect that it's just a placeholder function? (And why on earth don't they just throw an exception or something instead of dying silently?)Floristic
webkitSpeechRecognition - tries to find default speech recognition software to work. Chrome by default is streaming by chrome to google speech API to recognize speech (thats why you have so many languages that could be recognized). On mobiles there is usualy speech recognition software, Opera on that mobile device should work, on desktop it is not working. I hope that will help.Buttonwood
I added example from google demo page, very similar to window.hasOwnProperty but maybe it is making a difference, it detects webkit on my Chrome, but not in my Opera 42.Buttonwood
I'll be damned, using an Opera 42.0.2393.85, I get working/working. You don't? Weird. And... no, I don't think hasOwnProperty or a simple property check should make a difference.Floristic
I'm using Ubuntu 16.04.1, Opera 42.0.2393.85. I think that maybe on your OS there is some speech recognition software installed and Opera see it.Buttonwood
Accordnig to opera.com/help/tutorials/voice/using build voice recognition works only on Windows XP or 2000 or higher (so it need MS build speech to text program). I think the same logic is for webkitSpeechRecognition.Buttonwood
Z
1

The following Google sample uses a timestamp to detect that Opera did not trigger the start event: https://www.google.com/intl/en/chrome/demos/speech.html

Zamudio answered 24/3, 2018 at 11:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.