From 98a57c62355fa838ecaf48ee018cf5fe1034981f Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 26 Jan 2026 09:29:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(ios):=20=E4=BF=AE=E5=A4=8D=E8=80=B3?= =?UTF-8?q?=E6=9C=BA=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91=E4=BB=A5=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E5=BA=94=E7=94=A8=E9=9F=B3=E9=A2=91=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构耳机检测逻辑,使用统一的 `detectHeadphonesOutput` 方法替代分散的端口类型检查,提高代码可维护性并确保音频会话配置在不同耳机类型下的一致性。 --- .../ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6e5d516ab..ceb195a59 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 @@ -1467,7 +1467,7 @@ private func applyAudioSessionForTTS() -> Bool { let hasWiredHeadphones = outputs.contains(where: { $0.portType == .headphones || $0.portType == .headsetMic }) let hasBluetoothA2DP = outputs.contains(where: { $0.portType == .bluetoothA2DP || $0.portType == .bluetoothLE }) let hasBluetoothHFP = outputs.contains(where: { $0.portType == .bluetoothHFP }) - let hasHeadphones = hasWiredHeadphones || hasBluetoothA2DP || hasBluetoothHFP + let hasHeadphones = self.detectHeadphonesOutput() let otherAudioPlaying = audioSession.isOtherAudioPlaying let isRecording = (self.micCapture?.isCapturing == true) self.isHeadphones = hasHeadphones