异常 HRESULT:0x800455BC 在 Windows phone 8 中的语音识别 [英] Exception HRESULT: 0x800455BC in speech recognition in Windows phone 8
问题描述
我正在开发一个新的应用程序,我在其中使用 Windows Phone 8 的语音识别功能.但是,我收到以下异常:
I am developing a new app where I am using the speech recognition capability for windows phone 8. However, I am getting the following exception:
来自 HRESULT 的异常:0x800455BC
Exception from HRESULT: 0x800455BC
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()在 ExcerciseMod7Voice.MainPage.d__4.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ExcerciseMod7Voice.MainPage.d__4.MoveNext()
这是我尝试使用的代码:
And this is the code I'm trying to use:
private async void btnSpeak_Click(object sender, RoutedEventArgs e)
{
var recognizer = new SpeechRecognizerUI();
recognizer.Settings.ShowConfirmation = true;
recognizer.Settings.ReadoutEnabled = false;
try
{
var result = await recognizer.RecognizeWithUIAsync();
if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
{
MessageBox.Show(result.RecognitionResult.Text);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
当我运行应用程序并单击按钮说出它时,它会显示一条消息确认几秒钟,然后消失.
When I run the app and I click in the button to speak it displays a message confirmation for a few seconds and then disappears.
注意:我正在直接在我的手机上测试这个应用程序.(诺基亚 Lumia 920)
NOTE: I'm testing directly to my cellphone this app. (Nokia Lumia 920)
推荐答案
该错误消息表示该语言不受支持.我不确定你的语言设置是什么,但你可以使用你的语言环境来获得识别器(用你想要的文化交换 en-GB
)
That error message means that the language isn't supported. I'm not sure what your language settings are but you can get the recognizer with your locale using this (swap en-GB
with the culture you want)
var localRec = InstalledSpeechRecognizers.All
.Where(r => r.Language == "en-GB").FirstOrDefault();
然后使用该语言设置您的识别器
Then set your recognizer with that language
if(localRec != null)
recognizer.Recognizer.SetRecognizer(localRec);
else
MessageBox.Show("Recognizer with the language not found");
如果您没有在上面明确设置区域设置,那么系统将使用手机的Speech
设置中设置的语言.
If you don't explicitly set the locale above then the system will use the language set in the phone's Speech
settings.
这篇关于异常 HRESULT:0x800455BC 在 Windows phone 8 中的语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!