Android语音转文本问题

时间:2018-10-03 17:18:30

标签: android speech-recognition speech-to-text microsoft-cognitive

我正在尝试在我的Android设备上测试Cognitive-Speech-STT-Android示例项目 在将客户端库依赖项添加到Andoid Studio之后,创建一个试用帐户并添加Uri和主键 奇怪的行为导致应用程序返回此日志,但未收到文本结果:

Screen Capture

Android Studio日志:

I/NLPLAT: Auth token status: 404
originating error 0x8000ffff
10-03 14:41:43.902 21547-22632/com.example.robotvoicedemo I/NLPLAT: 
originating error 0x80070057
Authorization token hr 80070057 'S' 
Refreshing token S
Waiting for connection/send completion.
Transport error, hr=8E200002

I/NLPLAT: WebSocket closed unexpectedly, status: 0
Closing web socket channel
CU Client connection dropped
ConnectionStateChanged
Upgrade request returned with HTTP status code: 401.
Web socket handshake failed, hr=8E200002
web socket message delivery failed, hr=8E200002
Web socket channel already closed.
Message: 'S' has -1206569628 remaining transmit attempts.
Discarding failed message (name='S')
Reporting message failure to the observer (name='S')
Failed to 'hr', HR=8E200002, Failed to send message (name='S')
Transport error, hr=8E200002
Web socket channel already closed.
Message: 'S' has -1206569628 remaining transmit attempts.
Retrying message, name='S'

4 个答案:

答案 0 :(得分:2)

更新: 您用于检测连接的以下功能可以确定其是否已连接到网络,并且不能确定所连接的网络上是否可以访问互联网。但是,在您的情况下,这似乎不是问题,请尝试使用Google语音识别器,看看是否发生相同的问题,需要更多信息来为您提供解决方案

网络套接字连接旨在在没有网络时断开连接。请确保您具有有效的互联网连接,或者您可能没有添加<uses-permission android:name="android.permission.INTERNET" />来显示清单。

答案 1 :(得分:2)

我确实添加了权限并且设备已连接,还通过代码'

测试了连接状态
 private void checknetwork(){
    ConnectivityManager cm = (ConnectivityManager)BingTest.this.getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
    boolean isConnected = activeNetwork != null &&
            activeNetwork.isConnectedOrConnecting();

    if(isConnected){
        Log.i(TAG, "Device is Connected ++++++++++++ ");
    }else{
        Log.i(TAG, "Device is Not Connected ----------+ ");
    }
}

答案 2 :(得分:1)

您是否正在使用此示例? https://github.com/Azure-Samples/Cognitive-Speech-STT-Android

如果正确的话:

自9月以来,Microsoft推出了新的语音相关认知服务SDK:

我们发布了支持新的统一语音服务的新语音SDK。新的Speech SDK带有对Windows,Android,Linux,Javascript和iOS的支持。

请查看Microsoft Cognitive Services语音SDK,以获取文档(http://aka.ms/csspeech),下载页面的链接以及示例。

答案 3 :(得分:0)

万一某个人遇到我遇到的相同问题,事实证明MediaRecorder被另一应用阻止,则该问题在删除另一应用后得以解决