Merge pull request #3279 from pangeachat/show-audio-error

chore: set fetch audio error
This commit is contained in:
ggurdin 2025-06-27 08:48:27 -04:00 committed by GitHub
commit fe9eaf539d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:flutter/foundation.dart';
@ -202,12 +201,10 @@ class SelectModeButtonsState extends State<SelectModeButtons> {
File? file;
file = File('${tempDir.path}/${_audioBytes!.name}');
await file.writeAsBytes(_audioBytes!.bytes);
setState(() => _audioFile = file);
_audioFile = file;
}
if (mounted) setState(() => _isLoadingAudio = false);
} catch (e, s) {
debugger(when: kDebugMode);
_audioError = e.toString();
ErrorHandler.logError(
e: e,
s: s,
@ -217,6 +214,7 @@ class SelectModeButtonsState extends State<SelectModeButtons> {
messageEvent?.messageDisplayLangCode,
},
);
} finally {
if (mounted) setState(() => _isLoadingAudio = false);
}
}
@ -289,7 +287,7 @@ class SelectModeButtonsState extends State<SelectModeButtons> {
}
TtsController.stop();
matrix?.audioPlayer?.play();
await matrix?.audioPlayer?.play();
} catch (e, s) {
setState(() => _audioError = e.toString());
ErrorHandler.logError(