简体   繁体   中英

Windows Phone 8.1 Speech Synthesizer Access Denied?

I am trying to build an app that speaks to users when they press a button.

The speech synthesizer code is as follows

 Windows.Media.SpeechSynthesis.SpeechSynthesizer x = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
      var stream = await x.SynthesizeTextToStreamAsync(someString);
      var mediaElement = new MediaElement();
      mediaElement.SetSource(stream, stream.ContentType);
      mediaElement.Play();

While this code worked in a different app it does not work with this project. I keep receiving the following error.

  +     e   {System.UnauthorizedAccessException: Access is denied. Access is denied. at Windows.Media.SpeechSynthesis.SpeechSynthesizer..ctor()  at TalkingWalkingMaps.ManeuverDisplayer.<DisplayManeuver>d__0.MoveNext()}    System.Exception {System.UnauthorizedAccessException}

I read online that I had to remove the HKEY_CURRENT_USER\\Software\\Microsoft\\Speech\\CurrentUserLexicon value from my registry using regedit but this did not work.

Can Anyone Help?

It turns out the issue stems from the App Manifest file. Although not intuitive at first glance the Microphone Capability must be enabled for Speech Synthesizer to work. 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM