diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt index 661411b7a..a01e75561 100644 --- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt +++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt @@ -127,6 +127,11 @@ class AzureAsrHelper(private val context: Context) { this.supportedLanguages = supportedLanguages } + Log.i( + tag, + "lxm---ASR initialize: supportedLanguages=${supportedLanguages.joinToString(",")}, audioSourceType=$audioSourceType" + ) + val xunfeiConfigReady = this.xunfeiAppId.isNotBlank() && this.xunfeiAccessKeyId.isNotBlank() && this.xunfeiAccessKeySecret.isNotBlank() @@ -140,6 +145,11 @@ class AzureAsrHelper(private val context: Context) { this.currentLanguage = supportedLanguages[0] } + Log.i( + tag, + "lxm---ASR initialize derived: isAutoDetectLanguage=$isAutoDetectLanguage, currentLanguage=$currentLanguage, provider=${getAsrProvider()}, xunfeiConfigured=$xunfeiConfigReady" + ) + // 创建语音配置 speechConfig = SpeechConfig.fromSubscription(subscriptionKey, region).apply { if (isAutoDetectLanguage) { @@ -314,6 +324,7 @@ class AzureAsrHelper(private val context: Context) { } try { + Log.d(tag, "startContinuousRecognition: ${audioStream.isContinuousRecognitionActive}") xunFeiAsrHelper?.start(callback, currentLanguage, isAutoDetectLanguage, isRemoveFirstPunctuation) this.audioSourceType = audioSourceType diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureSpeechPlugin.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureSpeechPlugin.kt index 702f91aca..344d6fba1 100644 --- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureSpeechPlugin.kt +++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureSpeechPlugin.kt @@ -423,6 +423,13 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { val xunfeiAccessKeySecret = call.argument("xunfeiAccessKeySecret") ?: "" try { + val isXunfeiConfigured = xunfeiAppId.isNotBlank() && + xunfeiAccessKeyId.isNotBlank() && + xunfeiAccessKeySecret.isNotBlank() + FileLogger.i( + tag, + "lxm---ASR initialize args: supportedLanguages=${supportedLanguages.joinToString(",")}, useExternalAudio=$useExternalAudio, region=$region, xunfeiConfigured=$isXunfeiConfigured" + ) FileLogger.d(tag, "选择音频源类型: ${useExternalAudio}") // // 选择音频源类型 val audioSourceType = if (useExternalAudio) { diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift index 7f6928539..e12d4ed03 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift @@ -136,9 +136,27 @@ public class AzureAsrHelper: NSObject { $0 == "zh-CN" || $0 == "en-US" || $0 == "zh-HK" || $0 == "zh-TW" } && xunfeiConfigReady + os_log( + "ASR helper initialize: supportedLanguages=%{public}@, audioSourceType=%{public}@, xunfeiConfigured=%{public}@, provider=%{public}@", + log: log, + type: .info, + supportedLanguages.joined(separator: ","), + String(describing: audioSourceType), + String(xunfeiConfigReady), + asrProvider() + ) + // 根据支持的语言数量决定是否启用自动语言检测 self.isAutoDetectLanguage = supportedLanguages.count >= 2 + os_log( + "ASR helper initialize derived: isAutoDetectLanguage=%{public}@, currentLanguage=%{public}@", + log: log, + type: .info, + String(self.isAutoDetectLanguage), + self.currentLanguage + ) + // 如果只有一种语言,设置为当前语言 if !isAutoDetectLanguage && !supportedLanguages.isEmpty { self.currentLanguage = supportedLanguages[0] diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureSpeechPlugin.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureSpeechPlugin.swift index 1a00c6ef8..a27ec5faa 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureSpeechPlugin.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureSpeechPlugin.swift @@ -343,6 +343,16 @@ private func sendAstEvent(_ event: [String: Any]) { let xunfeiAppId = args["xunfeiAppId"] as? String ?? "" let xunfeiAccessKeyId = args["xunfeiAccessKeyId"] as? String ?? "" let xunfeiAccessKeySecret = args["xunfeiAccessKeySecret"] as? String ?? "" + let isXunfeiConfigured = !xunfeiAppId.isEmpty && !xunfeiAccessKeyId.isEmpty && !xunfeiAccessKeySecret.isEmpty + + os_log( + "ASR initialize args: supportedLanguages=%{public}@, region=%{public}@, xunfeiConfigured=%{public}@", + log: log, + type: .info, + supportedLanguages.joined(separator: ","), + region, + String(isXunfeiConfigured) + ) // 初始化ASR引擎 let success = azureAsrHelper.initialize(