Skip to content

Commit

Permalink
Initialize MediaKit even if TTS initialization fails on a FAW because…
Browse files Browse the repository at this point in the history
… of some engine problem
  • Loading branch information
MrCsabaToth committed Oct 20, 2024
1 parent 4d944ca commit 1977b73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:inspector_gadget/location/service/location.dart';
import 'package:inspector_gadget/preferences/service/preferences.dart';
import 'package:inspector_gadget/speech/service/stt.dart';
import 'package:inspector_gadget/speech/service/tts.dart';
import 'package:media_kit/media_kit.dart';

Future<void> bootstrap(FutureOr<Widget> Function() builder) async {
await runZonedGuarded<Future<void>>(
Expand Down Expand Up @@ -47,6 +48,7 @@ Future<void> bootstrap(FutureOr<Widget> Function() builder) async {
final sttService = SttService();
GetIt.I.registerSingleton(sttService);
unawaited(sttService.init());
MediaKit.ensureInitialized();
final ttsService = TtsService();
GetIt.I.registerSingleton(ttsService);
unawaited(ttsService.init());
Expand Down
3 changes: 0 additions & 3 deletions lib/speech/service/tts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:io';

import 'package:flutter_tts/flutter_tts.dart';
import 'package:inspector_gadget/common/state_logging_mixin.dart';
import 'package:media_kit/media_kit.dart';
import 'package:speech_to_text/speech_to_text.dart';
import 'package:strings/strings.dart';

Expand Down Expand Up @@ -65,8 +64,6 @@ class TtsService with StateLoggingMixin {
logEvent('TTS error: $msg');
});

MediaKit.ensureInitialized();

return this;
}

Expand Down

0 comments on commit 1977b73

Please sign in to comment.