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() {