Answer the question
In order to leave comments, you need to log in
Application throws InvalidOperationException?
Hello, when trying to recognize speech, an InvalidOperationException is thrown.
Code:
public class SpeechEngine : IDisposable
{
public string RecognizedText;
Windows.Media.SpeechRecognition.SpeechRecognizer speechRecognizer;
Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult;
public SpeechEngine()
{
speechRecognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer();
}
public async void StartRecognizing()
{
await speechRecognizer.CompileConstraintsAsync();
speechRecognitionResult = await speechRecognizer.RecognizeAsync();
}
public async void StopRecognizing()
{
await speechRecognizer.StopRecognitionAsync();
RecognizedText = speechRecognitionResult.Text;
}
public void Dispose()
{
speechRecognizer.Dispose();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question