csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
351 stars 218 forks source link

Question: Support Flutter Web? #107

Closed Gene-Dana closed 3 years ago

Gene-Dana commented 3 years ago

Just wondering if this would work in something like Flutter Web to expose the methods of a browser like chrome!

sowens-csd commented 3 years ago

Not yet, but it's an interesting idea. Do you know if Chrome (or other) browsers have speech recognition capabilities natively? Do you have any links?

hakandilek commented 3 years ago

hope these help:

Gene-Dana commented 3 years ago

Not yet, but it's an interesting idea. Do you know if Chrome (or other) browsers have speech recognition capabilities natively? Do you have any links?

Yes, Chrome is the only browser that has implemented it so far!

zyona3 commented 3 years ago

I cannot wait for Flutter Web.

I wanna create a flutter app with your awesome SpeechToText.

It is not compatible now.

TobiasHeidingsfeld commented 3 years ago

More love for Flutter Web. If I would find the time to implement this would you accept a pull request?

sowens-csd commented 3 years ago

Definitely! Always happy to have contributions. With the usual proviso that I'd review it for general code cleanliness and other goodness on the way in to make sure I could support it.

kofoednielsen commented 3 years ago

How would you feel about using an online stt provider for web support?

sowens-csd commented 3 years ago

The problem is that it requires separate accounts and usually there's a cost associated with it. It would make the web implementation very different from the iOS or Android. If there were a lot of interest in using online STT then adding it as an option for any deploy target might make sense.

sowens-csd commented 3 years ago

For those watching this issue the 3.0.0 version which is in main now is work in progress towards supporting this. It breaks out the platform interface so that it can be reimplemented for web. So, web support is not here yet but it is progressing.

Nicicalu commented 3 years ago

I'd love that! The only thing missing for me

sowens-csd commented 3 years ago

The current version on main has support for web if anyone wants to give it a try. I still need to add platform capability tests so that the plugin can report failure on browsers that don't support speech yet. Looks like right now Chrome and Edge support it.

Nicicalu commented 3 years ago

@sowens-csd Thanks so much! I have one problem though. When I launch the app (even your example web app) it throws this error. I ran it on chrome V88 and edge (Chromium) V88. Let me know if you need any more info

Error: Expected a value of type 'JSObject', but got one of type 'Event$' at Object.throw_ [as throw] (http://localhost:53511/dart_sdk.js:5306:11) at Object.castError (http://localhost:53511/dart_sdk.js:5277:15) at Object.cast [as as] (http://localhost:53511/dart_sdk.js:5593:17) at dart.LegacyType.new.as (http://localhost:53511/dart_sdk.js:7191:60) at Object._argumentErrors (http://localhost:53511/dart_sdk.js:5429:19) at Object._checkAndCall (http://localhost:53511/dart_sdk.js:5512:29) at Object.dcall (http://localhost:53511/dart_sdk.js:5521:17) at SpeechRecognition.ret (http://localhost:53511/dart_sdk.js:60934:21)

rodion-m commented 3 years ago

Same error as @Nicicalu

sowens-csd commented 3 years ago

Thanks so much for trying it out, I really appreciate it. Did you run the new multi_platform_example/lib/main.dart app? And what Flutter channel were you running? I used beta.

Also, and I know this shouldn't matter, but just so I have all the details, what OS are you running it on? I've tried it on Chrome Version 88.0.4324.96 (Official Build) (x86_64) running on Big Sur.

Nicicalu commented 3 years ago

@sowens-csd I am running dev channel. But ran the file multi_platform_example/lib/speech_main.dart because you added this file in your newest commit.

Nicicalu commented 3 years ago

Ok, I tested it on the beta channel and the launching the main.dart worked. Then, I did flutter upgrade so I have the newest flutter beta channel version, and it's not working any more. I am on Windows 10 20H2 (Build 19042.746), probably not important, because it worked, with the other beta channel version.

sowens-csd commented 3 years ago

Thanks for the feedback. I'll see what's going on with the beta upgrade, hopefully not too serious.

Nicicalu commented 3 years ago

@sowens-csd Thanks for your quick response! I am working on a school project where I use your library. Thanks<3

sowens-csd commented 3 years ago

Should be resolved now in the version in the repo. Getting closer to a release version. Flutter added native support for some of the underlying speech events in that beta upgrade so there were type conflicts.

Nicicalu commented 3 years ago

@sowens-csd I tested it and it worked fine! :) Thank you. Do you know if it's possible, that you can say words of different languages in one sentence? Like "Translate me Bahnhof to english".

sowens-csd commented 3 years ago

Thanks for the quick feedback, glad it's working. I better release before the Flutter team breaks it again.

As far as I know that is not supported by any of the speech recognition systems other than some 'adopted' words that are effectively native to that language, like hors d'oeuvres used in English.

Nicicalu commented 3 years ago

How would you create a translator using this plugin? Any tips? :) @sowens-csd

sowens-csd commented 3 years ago

I suppose I'd look at something like this https://cloud.google.com/translate or https://aws.amazon.com/translate/ fronted with speech recognition to create the text to send to the API. Both of those have fairly generous free tiers so they would be fine for a school project for example.

Nicicalu commented 3 years ago

@sowens-csd Thanks for this information. My problem is, that translation should be one of many functions (Like a voice assistant). But I think I can get creative and combine it with these cloud services. Thanks again :)

amin-531 commented 3 years ago

Hi, I use version 3.2.0 and works fine on android with all locales, but on web when I change locale it has no effect and recognize English again... is there limitation on locales on web ?

sowens-csd commented 3 years ago

Not a limitation, more of a bug. Can you try it with the fix I just committed? I haven't tested it yet because I'm on a different version of Flutter but it should resolve the issue.

Nicicalu commented 3 years ago

@sowens-csd For me it didn't work, I used your example, where there is a dropdown for the locales. On web it isn't working, even with the new commit. (At least for me)

amin-531 commented 3 years ago

Not a limitation, more of a bug. Can you try it with the fix I just committed? I haven't tested it yet because I'm on a different version of Flutter but it should resolve the issue.

@sowens-csd It works for me, thanks a lot...

Nicicalu commented 3 years ago

@sowens-csd Now the speech recognition is interpreting everything as English text. In the last version it would understand German

sowens-csd commented 3 years ago

web support is available in 4.0.0-nullsafety which is live on pub.dev now.

I tried French comprehension and it was working, the main issue seems to be getting the language code right. Unlike Android / iOS I haven't yet found a reliable source for the language codes. I hope to resolve that in an upcoming release. So far all I have tested successfully are 'en_US' and 'fr_FR'. @Nicicalu my German is not good enough to test it even if I did know the language code for sure, have you tried just 'de'?

Nicicalu commented 3 years ago

@sowens-csd Thanks for your answer. It looks like it's working in the newest version (4.0.0-nullsafety). Thank you for your constant effort. 🎉

Gene-Dana commented 3 years ago

Guys, this makes me so happy !

Gene-Dana commented 3 years ago

Should I close the issue now?

Nicicalu commented 3 years ago

Yes, everything works for me ;)

sowens-csd commented 3 years ago

Hearing that makes me happy, thanks! And yes, @Gene-Dana, please feel free to close. Always satisfying.

sk92129 commented 3 months ago

Are there any list of web browsers that this plugin should work in theory? desktop browsers and mobile browsers, edge, safari, etc.

sowens-csd commented 3 months ago

The plugin should support any browsers that support the web speech recognition standard. There's a section in the README with the info I've found on it.