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

Speech not working on some devices #417

Closed Clashkid155 closed 8 months ago

Clashkid155 commented 9 months ago

Using both the example app and my own code, my app doesn't work on some devices. I get one of two errors which are:

  1. error: error_permission
  2. error: error_language_not_supported

I have read and tried all your troubleshooting steps, but none seems to work. Interestingly enough, my emulator works but my device doesn't work.

Tested on:

  1. Poco F3 - Doesn't work.
  2. Infinix Hot 30i - Works.

Screenshot_20230731-151831_AlaSTT

Error log:

Launching lib/main.dart on M2012K11AG in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...
Debug service listening on ws://127.0.0.1:44633/uIgeeQorNw8=/ws
Syncing files to device M2012K11AG...
I/Gralloc4(23452): Adding additional valid usage bits: 0x546c08202000
W/Parcel  (23452): Expecting binder but got null!
I/flutter (23452): 2023-07-31T15:36:41.279406 Initialize
D/SpeechToTextPlugin(23452): Start initialize
D/SpeechToTextPlugin(23452): Checked permission
D/SpeechToTextPlugin(23452): has permission, completing
D/SpeechToTextPlugin(23452): completeInitialize
D/SpeechToTextPlugin(23452): Testing recognition availability
D/BluetoothHeadset(23452): Binding service...
D/SpeechToTextPlugin(23452): sending result
D/SpeechToTextPlugin(23452): leaving complete
D/SpeechToTextPlugin(23452): leaving initializeIfPermitted
D/SpeechToTextPlugin(23452): Received extra language broadcast
D/SpeechToTextPlugin(23452): No extra supported languages
D/BluetoothHeadset(23452): Proxy object connected
D/SpeechToTextPlugin(23452): Found a headset: android.bluetooth.BluetoothHeadset@896dff6
D/BluetoothHeadset(23452): Proxy object disconnected
D/BluetoothHeadset(23452): Unbinding service...
D/BluetoothHeadset(23452): Proxy object disconnected
D/SpeechToTextPlugin(23452): Clearing headset: 
D/SpeechToTextPlugin(23452): Clearing headset: 
D/BluetoothAdapter(23452): onBluetoothServiceDown
I/flutter (23452): 2023-07-31T15:36:58.840966 start listening
D/SpeechToTextPlugin(23452): before setup intent
D/SpeechToTextPlugin(23452): setupRecognizerIntent
D/SpeechToTextPlugin(23452): after setup intent
D/SpeechToTextPlugin(23452): Start listening
D/SpeechToTextPlugin(23452): setupRecognizerIntent
D/SpeechToTextPlugin(23452): Notify status:listening
D/SpeechToTextPlugin(23452): Start listening done
D/SpeechToTextPlugin(23452): Creating recognizer
D/SpeechToTextPlugin(23452): Setting default listener
D/SpeechToTextPlugin(23452): In RecognizerIntent apply
D/SpeechToTextPlugin(23452): put model
D/SpeechToTextPlugin(23452): put package
D/SpeechToTextPlugin(23452): put partial
D/SpeechToTextPlugin(23452): In RecognizerIntent apply
D/SpeechToTextPlugin(23452): put model
D/SpeechToTextPlugin(23452): put package
D/SpeechToTextPlugin(23452): put partial
D/SpeechToTextPlugin(23452): put languageTag
D/SpeechToTextPlugin(23452): Error 12 after start at 30 1000.0 / -100.0
D/SpeechToTextPlugin(23452): Notify status:notListening
D/SpeechToTextPlugin(23452): Notify status:doneNoResult
I/flutter (23452): 2023-07-31T15:36:58.879218 Received listener status: listening, listening: true
I/flutter (23452): 2023-07-31T15:36:58.882335 Received listener status: notListening, listening: false
I/flutter (23452): 2023-07-31T15:36:58.882763 Received listener status: done, listening: false
I/flutter (23452): 2023-07-31T15:36:58.885519 Received error status: SpeechRecognitionError msg: error_language_not_supported, permanent: true, listening: false

I tried adding another language pack but I still get only one language available

sowens-csd commented 9 months ago

Do those errors appear on different devices? One device shows the permission error and the other the language error? For the language that you are trying to use does that language work on some devices but not others? Or is that language not available anywhere?

There is an issue with getting locales for new versions of Android that I'm still trying to resolve, but that only affects the locales property, as long as you provide the correct language code the speech recognition still works.

Clashkid155 commented 9 months ago

Do those errors appear on different devices?

I'm only able to test on two physical devices, one is mine which I get those errors on, everything works well on the other device.

One device shows the permission error and the other the language error?

I get both errors on my device.

For the language that you are trying to use does that language work on some devices but not others? Or is that language not available anywhere?

I haven't tested that language on another device, but I was actually expecting more languages on my device, I have no idea why it only shows one.

sowens-csd commented 9 months ago

You say that you get both errors on your device. Can you describe the steps to reproduce each error? What Android version is your device?

Clashkid155 commented 9 months ago

https://github.com/csdcorp/speech_to_text/assets/21040700/40919d41-7c2c-48d8-8df3-4e94abf4040d

Error log is basically the same with the initial post. My device: A13 (Doesn't work)

My emulator: A13 (Pixel 6 pro; works)

Infinix: A12 (Works)

Clashkid155 commented 8 months ago

I no longer use the app so I'm closing this.