【问题标题】:ResponsiveVoice.js not working right with Phonegap compilerResponsiveVoice.js 无法与 Phonegap 编译器一起正常工作
【发布时间】:2017-01-19 04:16:36
【问题描述】:

为什么当 webapp 被编译成带有 phonegap 的 android 应用时,TTS 不工作?

我正在尝试使用 ResponsiveVoice.js 让 TTS 在我的 android 应用上运行,并通过 phonegap (https://build.phonegap.com/apps/2204237/builds) 进行编译

在经过测试的手机和台式机上的浏览器中,它运行良好,但一旦编译并转换为 apk,它就会停止运行。

单击响应按钮时,我正在使用基本的 jQuery 调用来调用 ResponsiveVoice.js。

按钮:

<section>
    <a rel="external" href="#" id="zero" type="button" value="Play">&#xF011</a>
        <span>0</span>
</section>

jQuery:

zero.onclick = function() {
    responsiveVoice.speak('Zero' + ' ' + $('#dropdown').val()  + ' ' + $('#name').val());
};

完整代码:https://github.com/hakarune/reading-pounds

测试页面:https://rawgit.com/hakarune/reading-pounds/master/index.html

有没有更好的方法来解决这个问题?我偶然发现了 ResponsiveVoice.js,它非常易于使用...

【问题讨论】:

    标签: javascript android jquery cordova phonegap-build


    【解决方案1】:

    如果您尝试调试您的应用程序,您会看到以下消息:

    RV:不支持语音合成

    它由 ResponsiveVoice 填充,因为在 Android 中没有定义语音合成

    您可以在此处看到它在 Android 版 Chrome 中受支持,但在 Cordova 应用程序上使用的 Android 浏览器中不支持。

    http://caniuse.com/#feat=speech-synthesis

    【讨论】:

    • 感谢您发现这一点,我在查看目录时没有发现这一点。所以没有办法使用RV,这是一种耻辱。谢谢您的帮助。猜猜我又回到了演讲中的绘图板。再次感谢。
    • 我的问题是有时我收到消息“未捕获的 ReferenceError:SpeechSynthesisUtterance 未定义”,有时它会起作用。我想 responsiveVoice 在我不理解的特定条件下调用 SpeechSynthesisUtterance...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-14
    • 2020-08-19
    • 2013-02-06
    • 2019-02-02
    • 2021-10-15
    相关资源
    最近更新 更多