flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

No audio playing on macOS - AudioContext configuration is not available on macOS

Open pikachupichu25 opened this issue 3 years ago • 1 comments

💬 Questions and Help

Updated: it suddenly works. I am not sure why it did not before. I did not change any setup for macOS. However, there is still a warning message.

I wrote a function that play audio of an input text.

Future<void> playTts(
  String text, {
  double volume = 0.5,
  double rate = 0.5,
  double pitch = 1.0,
}) async {
  if (kIsWeb) {
    rate = 1.0;
  }
  FlutterTts flutterTts = FlutterTts();

  await flutterTts.setVolume(volume);
  await flutterTts.setSpeechRate(rate);
  await flutterTts.setPitch(pitch);

  if (text.isNotEmpty) {
    await flutterTts.speak(text);
  }
}

Other information

[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-arm, locale en-TH)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.73.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

I tested on other platforms (iOS and web) and it works just fine. There is no audio played in macOS debug mode and it has a warning message in debug console: "AudioContext configuration is not available on macOS" How can I solve this issue for macOS?

pikachupichu25 avatar Nov 16 '22 09:11 pikachupichu25

@pikachupichu25 I do not receive the "AudioContext" error in my debug console. I only receive a Based on dependency analysis warning which appears to be related to swift linting.

flutter run -d macos
Downloading darwin-x64/FlutterMacOS.framework tools...           1,682ms
Downloading darwin-x64/gen_snapshot tools...                       296ms
Downloading darwin-x64-profile/FlutterMacOS.framework tools...      1,087ms
Downloading darwin-x64-profile tools...                            276ms
Downloading darwin-x64-profile/gen_snapshot tools...               290ms
Downloading darwin-x64-release/FlutterMacOS.framework tools...        563ms
Downloading darwin-x64-release tools...                            186ms
Downloading darwin-x64-release/gen_snapshot tools...               281ms
Launching lib/main.dart on macOS in debug mode...
Running pod install...                                           1,295ms
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
Building macOS application...                                           
Syncing files to device macOS...                                   104ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

dlutton avatar Nov 25 '22 22:11 dlutton