From 62d2ea5c2241bf495ee6c9b6a61f3a057a4e7232 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Mon, 8 Dec 2025 15:21:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(azure=5Fspeech):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E5=B8=A7=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=88=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用扩展函数toByteString替代ByteString.of,使代码更简洁 --- .../com/yunqiinnovation/azure_speech/XunFeiAsrHelper.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/XunFeiAsrHelper.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/XunFeiAsrHelper.kt index 51e15ad21..647e005f2 100644 --- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/XunFeiAsrHelper.kt +++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/XunFeiAsrHelper.kt @@ -5,6 +5,7 @@ import android.util.Base64 import android.util.Log import okhttp3.* import okio.ByteString +import okio.ByteString.Companion.toByteString import org.json.JSONObject import java.net.URLEncoder import java.nio.charset.StandardCharsets @@ -66,9 +67,7 @@ class XunFeiAsrHelper(private val context: Context) { } fun sendAudio(frameBuffer: ByteArray) { - webSocket?.let { ws -> - ws.send(ByteString.of(frameBuffer, 0, frameBuffer.size)) - } + webSocket?.send(frameBuffer.toByteString()) } fun close() {