Skip to content

Instantly share code, notes, and snippets.

@dragthor
Created January 26, 2015 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragthor/8e668ef1789186516884 to your computer and use it in GitHub Desktop.
Save dragthor/8e668ef1789186516884 to your computer and use it in GitHub Desktop.
private async void Image_PointerPressed(object sender, PointerRoutedEventArgs e)
{
var img = e.OriginalSource as Windows.UI.Xaml.Controls.Image;
if (img == null) return;
var title = img.Tag as string;
// The object for controlling the speech-synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
var stream = await synth.SynthesizeTextToStreamAsync(title);
MediaElement mediaElement = this.media;
// Send the stream to the media object.
mediaElement.SetSource(stream, "");
mediaElement.Play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment