【问题标题】:Google text to speech not working C# Android谷歌文本到语音不工作 C# Android
【发布时间】:2018-01-12 08:00:07
【问题描述】:

我正在使用 google text-speech 通过单击按钮将我的文本转换为语音,当我手动设置文本时效果很好

var textview = FindViewById<TextView>(Resource.Id.textView);
            textview.Text = "anuthing to speak";

但是当我从下面的函数中设置 textview 文本时,它什么也没说

public string CovertChapterToText(EpubChapter chapter)
        {
            HtmlDocument htmlDocument = new HtmlDocument();
            htmlDocument.LoadHtml(chapter.HtmlContent);
            StringBuilder sb = new StringBuilder();
            foreach (HtmlNode node in htmlDocument.DocumentNode.SelectNodes("//text()"))
            {
                sb.AppendLine(node.InnerText.Trim());
            }
            string chapterText = sb.ToString();
            return chapterText;
        }

喜欢

    textview.Text = CovertChapterToText(chapterToBeShown);

按钮点击事件

 btnSpeak.Click += delegate {

                    // if there is nothing to say, don't say it
                    if (!string.IsNullOrEmpty(textview.Text))
                        textToSpeech.Speak(textview.Text, QueueMode.Flush, null);

            };

【问题讨论】:

标签: c# android visual-studio xamarin.forms google-text-to-speech


【解决方案1】:

不知道为什么。但是 google tts 不会读取屏幕外的文本。当我从末尾删除一些字符时,它开始像魅力一样工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-05
    • 2011-10-05
    • 2014-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-01
    • 1970-01-01
    相关资源
    最近更新 更多