diff --git a/lib/modules/pairing/controllers/pairing_controller.dart b/lib/modules/pairing/controllers/pairing_controller.dart index 3347794bd..7304fadc8 100644 --- a/lib/modules/pairing/controllers/pairing_controller.dart +++ b/lib/modules/pairing/controllers/pairing_controller.dart @@ -732,7 +732,13 @@ class PairingController extends GetxController with WidgetsBindingObserver { try { // 设置超时定时器 _bleTimeoutTimer?.cancel(); - _bleTimeoutTimer = Timer(const Duration(seconds: 20), () { + _bleTimeoutTimer = Timer(const Duration(seconds: 10), () async { + final currentBleState = await _bleManager.getConnectionState(); + if (currentBleState == 2) { + _bleTimeoutTimer?.cancel(); + _transition(PairingState.completed); + return; + } if (_currentState.value == PairingState.waitingBle) { _setError(ErrorType.bleTimeout, 'bleConnectionTimeoutRetry'.tr); //BLE连接超时,请重启耳机后再试 diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift index 9afe14776..9a0b5f639 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift @@ -266,8 +266,11 @@ public class AzureTtsHelper: NSObject, ITtsService { lastSpokenText = "" // 重置计数器 pendingTextCount = 0 + + // 清空所有待处理任务并重置处理状态 taskLock.lock() pendingTasks.removeAll() + isProcessing = false // 重置处理状态 taskLock.unlock() do { @@ -474,6 +477,9 @@ public class AzureTtsHelper: NSObject, ITtsService { */ private func recreateSynthesizer() { do { + // 强制释放旧的合成器 + synthesizer = nil + // 创建音频配置 let audioConfig: SPXAudioConfiguration? if !useInternalPlayer || customAudioOutputStream != nil {