fix: tts
This commit is contained in:
@@ -120,6 +120,16 @@ class TextToSpeechController extends StateNotifier<TextToSpeechState> {
|
||||
return;
|
||||
}
|
||||
|
||||
final isCurrentlyActive =
|
||||
state.activeMessageId == messageId &&
|
||||
state.status != TtsPlaybackStatus.idle &&
|
||||
state.status != TtsPlaybackStatus.error;
|
||||
|
||||
if (isCurrentlyActive) {
|
||||
await stop();
|
||||
return;
|
||||
}
|
||||
|
||||
final available = await _ensureInitialized();
|
||||
if (!available) {
|
||||
if (!mounted) {
|
||||
@@ -133,15 +143,6 @@ class TextToSpeechController extends StateNotifier<TextToSpeechState> {
|
||||
return;
|
||||
}
|
||||
|
||||
final isCurrentlyActive =
|
||||
state.activeMessageId == messageId &&
|
||||
state.status != TtsPlaybackStatus.idle;
|
||||
|
||||
if (isCurrentlyActive) {
|
||||
await stop();
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
status: TtsPlaybackStatus.loading,
|
||||
activeMessageId: messageId,
|
||||
|
||||
Reference in New Issue
Block a user