简体   繁体   English

SpeechSynthesisUtterance在为Android构建的HTML5应用中不起作用

[英]SpeechSynthesisUtterance not working in an HTML5 app built for Android

So i am trying to build an HTML5 app with the Intel xdk .Now when i build the code below as a HTML5 app for Android and deploy it to my Android device, i cannot hear the sound when the function below is executed. 因此,我尝试使用Intel xdk构建HTML5应用程序。现在,当我将以下代码构建为Android的HTML5应用程序并将其部署到我的Android设备时,执行以下功能时我听不到声音。

function speak(){
        var foo = new SpeechSynthesisUtterance("Speech");
        foo.voice = voices.filter(function(voice) { return voice.name == 'Agnes'; })[0];
        foo.volume = 0.5; // 0 to 1
        foo.rate = 0.7; // 0.1 to 10
        foo.pitch = 0.8; //0 to 2
        //foo.lang = 'en-GB';
        window.speechSynthesis.speak(foo);
    }

I simply do not know how HTML5 apps on devices work, because if i put this function in a html file and try to access it in Chrome on Android, it works just fine. 我只是不知道设备上的HTML5应用程序如何工作,因为如果我将此功能放在html文件中并尝试在Android上的Chrome浏览器中访问它,就可以正常工作。 So my question is, just what do i need to do to get this SpeechSynthesisUtterance working as expected in an Android HTML5 app. 所以我的问题是,我要怎么做才能使SpeechSynthesisUtterance在Android HTML5应用程序中按预期工作。

My test device is a Samsung Galaxy S3 running the 4.3 Android update which was released very recently. 我的测试设备是运行最近发布的4.3 Android更新的Samsung Galaxy S3。

This feature is in Chrome 33 ( announcement ). 此功能在Chrome 33( 公告 )中。 It is not in the Android web view so it will not work with the XDK android build or any cordova/phonegap builder. 它不在Android网络视图中,因此无法与XDK android构建或任何cordova / phonegap构建器一起使用。 It will be available in crosswalk 5, so the XDK crosswalk android build will have it in late March when crosswalk 5 is released. 它将在人行横道5中可用,因此X人行横道android构建将在3月下旬人行横道5发布时使用。 See crosswalk release schedule 查看人行横道发布时间表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM