felixjunghans / google_speech

Flutter google spech
MIT License
68 stars 40 forks source link

Support Google Speech Version 2 in Endless stream (EndlessStreamingServiceV2?) #58

Closed JulianPscheid closed 4 months ago

JulianPscheid commented 4 months ago

I've started using EndlessStreamingService and it works well! But I would prefer to use Google Speech Version 2 due to the lower price and (supposedly) better performance. Since Cloud Speech-to-Text V2 is already supported in this package for other transcription options, I wonder if it would be possible to adapt it for EndlessStreamingService?

felixjunghans commented 4 months ago

Hey @JulianPscheid, pls try EndlessStreamingServiceV2 :)

JulianPscheid commented 4 months ago

Thanks! I didn't catch that you already had a class for that... you're the boss!

Unfortunately I'm unable to get EndlessStreamingServiceV2 to work after swapping in RecognitionConfigV2, etc. The app halts on a non-helpful runtime error:

flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:635:13) flutter: │ #1 AudioRecognizeController.streamingRecognize (package:hedy_mobile/controllers/audio_recognize_controller.dart:65:21) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> startRecorder flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:659:13) flutter: │ #1 FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound_lite/public/flutter_sound_recorder.dart:637:13) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> _startRecorder. flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorderCompleted (package:flutter_sound_lite/public/flutter_sound_recorder.dart:249:13) flutter: │ #1 MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:74:22) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 ---> startRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorderCompleted (package:flutter_sound_lite/public/flutter_sound_recorder.dart:258:13) flutter: │ #1 MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:74:22) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 <--- startRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:750:13) flutter: │ #1 <asynchronous suspension> flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:<--- _startRecorder. flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorder (package:flutter_sound_lite/public/flutter_sound_recorder.dart:647:13) flutter: │ #1 <asynchronous suspension> flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:<--- startRecorder flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: gRPC Error (code: 1, codeName: CANCELLED, message: The operation was cancelled., details: [], rawResponse: null, trailers: {})

If there's an example I could look at somewhere, that would be great.

felixjunghans commented 4 months ago

I have updated the Endless Streaming Example to work with v2. I double checked it and it should work. Please try it out :)

JulianPscheid commented 4 months ago

Excellent, following that example worked! Nice work! Vielen Dank!