0

当我尝试将语言设置为 SpeechRecognize (Windows Phone 8.1) 时,它会运行异常。但是在文档中告诉我按照我正在做的方式做 D;

这有效:

private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var rec = new SpeechRecognizer();
            await rec.CompileConstraintsAsync();
            rec.UIOptions.AudiblePrompt = "Aguardando o comando";
            var stream = await rec.RecognizeWithUIAsync();

        }

这不起作用:

private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
             var rec = new SpeechRecognizer(new Windows.Globalization.Language("pt-BR"));
            await rec.CompileConstraintsAsync();
            rec.UIOptions.AudiblePrompt = "Aguardando o comando";
            var stream = await rec.RecognizeWithUIAsync();

        }

有人可以帮助我吗?

4

1 回答 1

0

我认为那是因为您安装的 Locale 不是那种语言。如果你想确定,试试这个:

private async void Button_Click_1(object sender, RoutedEventArgs e)
    {
           try(){
         var rec = new SpeechRecognizer(new Windows.Globalization.Language("pt-BR"));
        await rec.CompileConstraintsAsync();
        rec.UIOptions.AudiblePrompt = "Aguardando o comando";
        var stream = await rec.RecognizeWithUIAsync();
            }
         catch(Exception e)
           {
             Debug.WriteLine(e);
            }

    }
于 2015-11-04T14:21:31.857 回答