3
どこから音声認識ポリシーを受け入れる必要がありますか?ここで例外:音声認識を試行する前に音声プライバシーポリシーが受け入れられていません
それはスピーチ、インキングやタイピングの下に設定されたコード
public async void display()
{
SpeechRecognizer rec = new SpeechRecognizer();
await rec.CompileConstraintsAsync();
rec.Timeouts.InitialSilenceTimeout = TimeSpan.FromSeconds(5);
rec.Timeouts.EndSilenceTimeout = TimeSpan.FromSeconds(20);
rec.UIOptions.AudiblePrompt = "I am listening";
rec.UIOptions.ShowConfirmation = true;
rec.UIOptions.IsReadBackEnabled = true;
rec.Timeouts.BabbleTimeout = TimeSpan.FromSeconds(5);
SpeechRecognitionResult result = await rec.RecognizeAsync(); // Error here
if (result!=null)
{
textBlock.Text= result.Text;
}
}