【问题标题】:How can I solve System.Runtime.InteropServices.COMException using SpeechRecognizer UWP?如何使用 SpeechRecognizer UWP 解决 System.Runtime.InteropServices.COMException?
【发布时间】:2018-10-11 16:48:09
【问题描述】:

我在使用 SpeechRecognizer 时遇到了 System.Runtime.InteropServices.COMException (0x80070490)。

我在网上看到这个错误可能是由于未启用功能或清单已损坏。

我启用了 Internet(客户端)和麦克风,我还尝试了一个干净的清单文件,但它导致相同的错误消息。

有人知道我做错了什么吗?这是一个 UWP 应用,我使用的是 Windows 10 Build 1709。

我的代码:

using System;
using System.Diagnostics;
using Windows.Media.SpeechRecognition;

namespace SpeechRecognitionRPi
{
    class SpeechHandling
    {
        public async void StartRecognition()
        {
            // Create an instance of SpeechRecognizer.
            var speechRecognizer = new SpeechRecognizer();

            // Compile the dictation grammar by default.
            await speechRecognizer.CompileConstraintsAsync();

            // Start recognition.
            SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync();

            // Do something with the recognition result.
            var messageDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Text spoken");
            await messageDialog.ShowAsync();

        }
    }
}

【问题讨论】:

    标签: c# uwp win-universal-app speech-recognition


    【解决方案1】:

    通过在 Windows 中启用英美语言修复,您还需要从语言选项安装语音模块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-21
      • 2017-07-27
      • 2011-05-15
      • 2020-11-10
      相关资源
      最近更新 更多