【问题标题】:Android Speech to Text IssueAndroid 语音转文本问题
【发布时间】:2018-10-03 17:18:30
【问题描述】:

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

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'

【问题讨论】:

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


    【解决方案1】:

    我确实添加了权限并且设备已连接,还从代码中测试了连接状态:'

     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】:

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

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

      【讨论】:

      • 您好 Naveen,我确实添加了权限并且设备已连接,还从代码测试了连接状态:''
      • 谢谢 我使用 Azure 的原因是即使在安装 Google App(com.google.android.googlequicksearchbox) 之后,我在谷歌语音识别器上也出现错误 3(音频错误)
      • 这在所有设备上都一样吗?试试另一个模拟器(或)试试这个stackoverflow.com/questions/5253740/…
      • 我确实安装了谷歌服务并使用 adb 从 adb 启用它:(adb shell==>su==>pm enable com.google.android.googlequicksearchbox Got Package com.google.android.googlequicksearchbox new state :启用)仍然是同样的问题
      • 是的,我现在怀疑的是,该服务已从操作系统架构层停用
      【解决方案3】:

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

      如果正确:

      自 9 月起,微软推出了新的语音相关认知服务 SDK:

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

      请查看 Microsoft 认知服务语音 SDK 以获取文档 (http://aka.ms/csspeech)、下载页面链接和示例。

      【讨论】:

      • 感谢您的回答,原来 MediaRecorder 已被阻止
      【解决方案4】:

      如果有人遇到与我相同的问题,原来 MediaRecorder 被另一个应用程序阻止,删除另一个应用程序后问题得到解决

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-05-19
        • 1970-01-01
        • 1970-01-01
        • 2012-08-01
        • 1970-01-01
        相关资源
        最近更新 更多