Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Speech Synthesis not working on my website

$
0
0

I have created a desktop application to convert TEXT to SPEECH, so i tried it on web forms but its not working. 

-There is 1 textBox and 1 Iframe on my page, if u put any link in textbox n hit "go" button i frame will show dat webpage in my page.(achieved)

-When i hit another button my page reads out text written on IFRAME webpage. This works fine on my machine but its not working when i upload it on my website. I am using HTMLAgility pack to get the text

Below is the complete code  :

//Go button to show another website in IFRAME
protected void Button1_Click(object sender, EventArgs e)
    {
        frame.Attributes["src"] = urlBox.Text;
    }

//Read button to read out text on web page getting displayed in IFRAME
    protected void Button2_Click(object sender, EventArgs e)
    {

        ss.SetOutputToDefaultAudioDevice();
        ss.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);
        //ss.Dispose();
        WebClient client = new WebClient();
        string downloadString = client.DownloadString(urlBox.Text);

        HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
        HtmlAgilityPack.HtmlDocument doc = web.Load(urlBox.Text);
        var result = doc.DocumentNode.SelectNodes("//body//text()");//return HtmlCollectionNode
        string AchivedText;
        foreach (var node in result)
        {
            //Speak(VoiceGender.Female);
            AchivedText = node.InnerText;//Your desire text
            ss.SpeakAsync(AchivedText);
        }
    }

//Stops the reading of web page
    protected void Button3_Click(object sender, EventArgs e)
        {
            ss.Dispose();
        }




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>