无法使Cordova文本语音转换插件正常工作 [英] Cannot get Cordova text-to-speech plugin to work

查看:193
本文介绍了无法使Cordova文本语音转换插件正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试各种TTS插件,包括 https://github.com上的插件/ vilic / cordova-plugin-tts ,但无法正常工作。例如,根据文档,此用法的用法应为:

I'm trying various plugins for TTS, including the one at https://github.com/vilic/cordova-plugin-tts, but cannot get any to work. For this one, for example, according to the docs, its usage should be:

    TTS
    .speak('hello, world!', function () {
        alert('success');
    }, function (reason) {
        alert(reason);
    });

但是我得到了 TTS未定义。也尝试过 navigator.TTS ....,但效果仍然不佳。另外,我不确定是否需要在包中包含tts.js;如果是这样,我会得到未定义的出口。如果有人成功使用了此插件,请您把我的方向正确吗?或者,如果有其他可行的插件,我可以使用,但是GitHub上的许多TTS插件在3-4年内似乎不受支持。
我正在使用的BTW其他插件(例如地理定位)工作正常

but I get 'TTS not defined'. Also tried 'navigator.TTS....' but still no good. Also I'm unsure whether I need to include the tts.js in the package; if so I get 'exports not defined'. If anyone is successfully using this plugin, please can you put me in the correct direction? Or if there's an alternative plugin that works, I could use that, but many TTS plugins on GitHub appear unsupported for 3-4 years. BTW other plugins I am using (e.g. geolocation) are working fine

推荐答案

现在已经解决了此问题。我的index.html中没有< script src = cordova.js>< / script> 。这也阻止了 onDeviceReady启动,这就是我解决它的方法。
这样看来,您需要一些插件包含此脚本,而其他插件则不需要。真令人困惑。
我可以自己索回50分的奖励积分吗? ;)

Have now solved this. I didn't have <script src="cordova.js"></script> in my index.html. This was also stopping 'onDeviceReady' from firing, which is how I came about solving it. So it seems you need this script included for some plugins but not for others. How confusing. Can I claim back my 50 bonus points for solving it myself? ;)

这篇关于无法使Cordova文本语音转换插件正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆