'Flutter audio from earpiece on ios while speech to text is initialized
On my app on ios, I am using flutter tts for audio output and speech to text for input. Only if STT is initialized the volume is very low because the audio is coming from the earpiece and not from the speaker.
I have already tried different categories Flutter text to speech low volume on ios. But nothings has changed.
On android I could not test it yet because I have not figured out why I can not initialize STT.
My code:
final FlutterTts tts = FlutterTts();
final SpeechToText stt = SpeechToText();
void onInit() {
Wakelock.enable().then((_) async => print(await Wakelock.enabled)); //keep the device screen awake
initTts();
initStt();
}
void initTts() async {
await tts.setLanguage("de-DE");
await tts.setVolume(1.0);
await tts.setIosAudioCategory(IosTextToSpeechAudioCategory.playAndRecord, [
IosTextToSpeechAudioCategoryOptions.mixWithOthers
]);
speakWelcomeText();
}
void initStt() async {
await stt.initialize(
onStatus: (val) => print('[stt] onStatus: $val'),
onError: (val) => print('[stt] onError: $val'),
);
}
`
``
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
