csdcorp/speech_to_text

SpeechRecognitionError: error_permission && error_client

Closed this issue · 1 comments

image

I tested it on a virtual machine, and it works fine on Android 11. However, when I run it on a real device with Android 12, it throws two exceptions: error: SpeechRecognitionError msg: error_permission, permanent: true and error: SpeechRecognitionError msg: error_client, permanent: true.

image

Here is my code

` final SpeechToText _speechToText = SpeechToText();
bool _speechEnabled = false;

//.....

if (!_speechEnabled) {
_speechEnabled = await _speechToText.initialize(
finalTimeout: const Duration(minutes: 10),
onStatus: (status) {
debugPrint("Status: $status");
},
onError: (error) {
debugPrint("error: ${error.toString()}");
},
);
}
if (!_speechEnabled) return;
_speechToText.listen(
listenFor: const Duration(minutes: 10),
pauseFor: const Duration(seconds: 60),
listenOptions: SpeechListenOptions(
listenMode: ListenMode.dictation,
onDevice: false,
partialResults: true,
cancelOnError: true,
),
onResult: (result) {
final text = result.recognizedWords;
debugPrint(text);
});
`

I solved the problem. It was not an issue with the library but rather my device not functioning properly. After that, I downloaded Google's voice search application and ran it, and the problem was resolved.