i am trying to highlight words read by the text to speech but its not working. until now i made:
string startSpan = "<span style=" + "background-color:Yellow" + ">";
string endSpan = "</span>";
//button onclick
protected void speak_Hope(object sender, EventArgs e)
{
speaker.Rate = -4;
speaker.SpeakAsync(announce.InnerText);
speaker.SpeakProgress += new EventHandler<SpeakProgressEventArgs> (speaker_SpeakProgress);
System.Diagnostics.Debug.WriteLine("processing");
}
void speaker_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
counter2 = e.CharacterPosition - 10;
counter3 = e.Text.Length;
counter4 = counter2 + counter3;
System.Diagnostics.Debug.WriteLine(e.CharacterPosition - 10 + " next one" + e.Text);
announce.InnerHtml = announce.InnerText.Substring(0, counter2) + startSpan + announce.InnerText.Substring(counter2, counter3) + endSpan + announce.InnerText.Substring( announce.InnerText.Length - 1);
}
am i doing it right or is there any other way, can it be done in a javascript manner? thanks alot