I made a simple UWP application to test speech recognition function, But I have some error, it shows: System.UnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
SpeechRecognizer recognizer = new SpeechRecognizer();
private async void Record_Click(object sender, RoutedEventArgs e)
{
var topUserLanguage = GlobalizationPreferences.Languages[0];
var language = new Language(topUserLanguage);
recognizer = new SpeechRecognizer(language);
await recognizer.CompileConstraintsAsync();
recognizer.Timeouts.InitialSilenceTimeout = TimeSpan.FromDays(1);
var recordResult = await this.recognizer.RecognizeAsync();
result.Text = recordResult.Text;
}
}