Hi Community,
I have googled/searched but just couldn't find a working solution. Hopefully can get some help from the experts here...🥺
In reference to this FF's tutorial video: https://www.youtube.com/watch?v=1GmgjkZiDsk&ab_channel=FlutterFlow
I have an app with voice chat feature using FF's STT and TTS packages. The TTS audio output from AI is loud and clear on laptop/computer browser testing, but when I opened the URL on mobile browser, it's all silent, no audio can be heard. Using my iPhone, I had the sound on, I allowed the app access the microphone, I had volume on but just couldn't hear anything, but there is active API call and message that being read. Also, when using the microphone to startRecording, I kept getting "No speech detected" (my preset error log message in custom action).
Is this a known issue, or audio isn't supposed to be heard on mobile browser, or there is something else I can do to allow me to hear audio on mobile browser from AI response, as well as being heard to provide speech input for AI to respond? Would this only work if the app is being deployed to Apple Store? How do you perform testing on your similar apps?
Here are the lines of codes I tried to make sure the app handle on web / iOS. Any help is greatly appreciated!
Scarlett
import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'dart:async'; // Required for Timer
import 'dart:io';
Future<int> textToSpeech(String text, String figure) async {
final FlutterTts flutterTts = FlutterTts();
// Set iOS-specific audio category to ensure proper audio playback on iPhones
if (!kIsWeb && (Platform.isIOS || Platform.isAndroid)) {
await flutterTts.setIosAudioCategory(
IosTextToSpeechAudioCategory.playAndRecord,
[
IosTextToSpeechAudioCategoryOptions.duckOthers,
IosTextToSpeechAudioCategoryOptions.defaultToSpeaker,
IosTextToSpeechAudioCategoryOptions
.interruptSpokenAudioAndMixWithOthers,
],
);
}