Home » Android » android – Speech translation during an AGORA call-Exceptionshub

android – Speech translation during an AGORA call-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I need to integrate google translation during video call from Agora (RTC)
Needed behaviour: opponent says something, I hear his speech, after that I need to hear his speech again, but translated to selected language.
I use next code:

 Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH.toString());
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.ENGLISH.toString());
        intent.putExtra(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES, Locale.ENGLISH.toString());

        try {
            speechRecognizer.startListening(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }

But when I try to implement this, I receive ERROR_AUDIO error in calback all the time.
When I put this code out from call, everything is okay

How to&Answers: