Hi everyone. Has anyone had any luck with using Google's text to speech on WP7? Why won't this code work? Am I missing something obvious?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO;
namespace WCTest
{
public partial class MainPage : PhoneApplicationPage
{
string searchString = "http://translate.google.com/translate_tts?tl=en&q=hello";
// Constructor
public MainPage()
{
InitializeComponent();
WebClient client = new WebClient();
client.OpenReadCompleted += (s, e) =>
{
if (e.Error == null)
{
Stream audio = e.Result;
mediaElement1.SetSource(audio);
mediaElement1.Play();
}
client.OpenReadAsync(new Uri(searchString));
};
}
}
}