微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何继续运行RecognizerIntent并从麦克风输入获取语音到文本字符串

如何解决如何继续运行RecognizerIntent并从麦克风输入获取语音到文本字符串

        string rec = global::Android.Content.PM.PackageManager.FeatureMicrophone;
        if (rec == "android.hardware.microphone")
        {
            var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
            voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel,RecognizerIntent.LanguageModelFreeForm);
            voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis,1500);
            voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis,1500);
            voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis,15000);
            voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults,1);
            voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage,Java.Util.Locale.Default);
            _activity.StartActivityForResult(voiceIntent,10);
        }
        else
        {
            throw new Exception("No mic found");
        }

我正在使用“ Plugin.CurrentActivity”插件传递当前活动。我想要做的是连续运行监听器,而不会提示Google语音弹出窗口。监听器在被按钮停止之前不应停止。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。