整个课程和数据UI重新设计版本
This commit is contained in:
@@ -29,14 +29,11 @@ class VoiceService {
|
||||
if (_ttsInitialized) return;
|
||||
try {
|
||||
if (Platform.isIOS) {
|
||||
await _tts.setIosAudioCategory(
|
||||
IosTextToSpeechAudioCategory.playback,
|
||||
[
|
||||
IosTextToSpeechAudioCategoryOptions.allowBluetooth,
|
||||
IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
|
||||
IosTextToSpeechAudioCategoryOptions.mixWithOthers,
|
||||
],
|
||||
);
|
||||
await _tts.setIosAudioCategory(IosTextToSpeechAudioCategory.playback, [
|
||||
IosTextToSpeechAudioCategoryOptions.allowBluetooth,
|
||||
IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
|
||||
IosTextToSpeechAudioCategoryOptions.mixWithOthers,
|
||||
]);
|
||||
}
|
||||
await _tts.setVolume(1.0);
|
||||
await _tts.setPitch(1.0);
|
||||
@@ -162,7 +159,11 @@ class VoiceService {
|
||||
if (!await recordings.exists()) return const [];
|
||||
final files = await recordings
|
||||
.list()
|
||||
.where((item) => item is File && (item.path.endsWith('.wav') || item.path.endsWith('.m4a')))
|
||||
.where(
|
||||
(item) =>
|
||||
item is File &&
|
||||
(item.path.endsWith('.wav') || item.path.endsWith('.m4a')),
|
||||
)
|
||||
.cast<File>()
|
||||
.toList();
|
||||
files.sort((left, right) => right.path.compareTo(left.path));
|
||||
@@ -206,7 +207,10 @@ class VoiceService {
|
||||
_errorListener = onError;
|
||||
try {
|
||||
if (!_speechReady || !_stt.isAvailable) {
|
||||
final ready = await initializeSpeech(onStatus: onStatus, onError: onError);
|
||||
final ready = await initializeSpeech(
|
||||
onStatus: onStatus,
|
||||
onError: onError,
|
||||
);
|
||||
if (!ready) return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user