felixjunghans / google_speech

Flutter google spech
MIT License
68 stars 41 forks source link

Failure to start recorder issue for endless recording #54

Closed JawadZ02 closed 9 months ago

JawadZ02 commented 9 months ago

Hi, hope you are well. I ran the endless recording example, but when I click on the button "Start endless streaming from mic", it does not ask for mic permission and does not start recording. I have pasted below the debug messages that appear in the terminal right after I press the start button. It seems to say that the audio recorder failed to start. I hope you can help me with this, I would be immensely grateful! Note: I am running the app on an android emulator.

I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder.openAudioSession (package:flutter_sound_lite/public/flutter_sound_recorder.dart:393:13)
I/flutter ( 8469): │ #1   _AudioRecognizeState.streamingRecognize (package:flutter_sound_example/main.dart:59:21)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 FS:---> openAudioSession 
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound_lite/public/flutter_sound_recorder.dart:413:13)
I/flutter ( 8469): │ #1   FlutterSoundRecorder.openAudioSession.<anonymous closure> (package:flutter_sound_lite/public/flutter_sound_recorder.dart:395:17)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 ---> openAudioSession
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound_lite/public/flutter_sound_recorder.dart:428:17)    
I/flutter ( 8469): │ #1   FlutterSoundRecorder.openAudioSession.<anonymous closure> (package:flutter_sound_lite/public/flutter_sound_recorder.dart:395:17)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 Resetting flutter_sound Recorder Plugin
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469): Failed to handle method call
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:435)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:272)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at com.dooboolab.fluttersound.FlutterSoundManager.resetPlugin(FlutterSoundManager.java:88)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at com.dooboolab.fluttersound.FlutterSoundRecorderManager.onMethodCall(FlutterSoundRecorderManager.java:70)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:322)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$2j2MERcK825A5j1fv5sZ7xB2Iuo.run(Unknown Source:12)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at android.os.Looper.loopOnce(Looper.java:205)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at android.os.Looper.loop(Looper.java:294)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at android.app.ActivityThread.main(ActivityThread.java:8177)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 8469):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/DartMessenger( 8469): Uncaught exception in binary message listener
E/DartMessenger( 8469): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger( 8469):         at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:435)
E/DartMessenger( 8469):         at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:287)      
E/DartMessenger( 8469):         at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/DartMessenger( 8469):         at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:322)
E/DartMessenger( 8469):         at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$2j2MERcK825A5j1fv5sZ7xB2Iuo.run(Unknown Source:12)
E/DartMessenger( 8469):         at android.os.Handler.handleCallback(Handler.java:958)
E/DartMessenger( 8469):         at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger( 8469):         at android.os.Looper.loopOnce(Looper.java:205)
E/DartMessenger( 8469):         at android.os.Looper.loop(Looper.java:294)
E/DartMessenger( 8469):         at android.app.ActivityThread.main(ActivityThread.java:8177)
E/DartMessenger( 8469):         at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger( 8469):         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/DartMessenger( 8469):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
D/EGL_emulation( 8469): app_time_stats: avg=7715.23ms min=7715.23ms max=7715.23ms count=1
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder.openRecorderCompleted (package:flutter_sound_lite/public/flutter_sound_recorder.dart:186:13)
I/flutter ( 8469): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98:22)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 ---> openRecorderCompleted: true
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder.openRecorderCompleted (package:flutter_sound_lite/public/flutter_sound_recorder.dart:197:13)
I/flutter ( 8469): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98:22)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 <--- openRecorderCompleted: true
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound_lite/public/flutter_sound_recorder.dart:449:13)    
I/flutter ( 8469): │ #1   <asynchronous suspension>
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 <--- openAudioSession
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder.openAudioSession (package:flutter_sound_lite/public/flutter_sound_recorder.dart:403:13)     
I/flutter ( 8469): │ #1   <asynchronous suspension>
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 FS:<--- openAudioSession 
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
D/permissions_handler( 8469): No permissions found in manifest for: []7
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder.startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:635:13)        
I/flutter ( 8469): │ #1   _AudioRecognizeState.streamingRecognize (package:flutter_sound_example/main.dart:78:21)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 FS:---> startRecorder
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8469): │ #0   FlutterSoundRecorder._startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:659:13)       
I/flutter ( 8469): │ #1   FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound_lite/public/flutter_sound_recorder.dart:637:13)
I/flutter ( 8469): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8469): │ 🐛 FS:---> _startRecorder.
I/flutter ( 8469): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
E/AudioRecord( 8469): createRecord_l(808793378): AudioFlinger could not create record track, status: -1
E/AudioRecord-JNI( 8469): Error creating AudioRecord instance: initialization check failed with status -1.
E/android.media.AudioRecord( 8469): Error code -20 when initializing native AudioRecord object.
E/flutter ( 8469): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)
E/flutter ( 8469): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter ( 8469): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
E/flutter ( 8469): <asynchronous suspension>
E/flutter ( 8469): #2      FlutterSoundRecorder._startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:732:7)       
E/flutter ( 8469): <asynchronous suspension>
E/flutter ( 8469): #3      FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound_lite/public/flutter_sound_recorder.dart:637:7)
E/flutter ( 8469): <asynchronous suspension>
E/flutter ( 8469): #4      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)
E/flutter ( 8469): <asynchronous suspension>
E/flutter ( 8469): #5      FlutterSoundRecorder.startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:636:5)        
E/flutter ( 8469): <asynchronous suspension>
E/flutter ( 8469): #6      _AudioRecognizeState.streamingRecognize (package:flutter_sound_example/main.dart:78:5)
E/flutter ( 8469): <asynchronous suspension>
JawadZ02 commented 9 months ago

Okay so I found out the example app did not have the android audio record permission, so I added that and the error got fixed. However, now when I click the start button, it asks for mic access permission which is good, but after that I tried speaking and nothing is getting transcribed and shown on the screen. I just see these two terminal messages, which I dont understand:

I/flutter ( 9956): Starte neuen Stream
I/flutter ( 9956): Warte auf Timer Ende
JawadZ02 commented 9 months ago

Turns out it was a problem with the emulator that wasnt taking my audio. It works perfectly now and its amazing! Sorry for the inconvenience of opening this issue, and thanks again for your efforts on this!