首页 > 解决方案 > 在 Oppo 中将语音转换为文本时出现录音和客户端错误

问题描述

如何在将语音转换为文本时修复 语音识别ERROR_AUDIO = 3(Audio recording error)ERROR_CLIENT = 5(Client side error)(使用带有计时器的自定义对话框进行录音)


   speechRecognizer = SpeechRecognizer.createSpeechRecognizer(context!!)
        speechRecognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
        speechRecognizerIntent?.putExtra(
            RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
        )
        speechRecognizerIntent?.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
        speechRecognizerIntent?.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3)
        speechRecognizer?.setRecognitionListener(this)

标签: androidandroid-studiokotlin

解决方案


推荐阅读