SpeechSynthesisUtterance not working in an HTML5 app built for Android

梦想与她 提交于 2020-01-16 01:08:22

问题


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.

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. So my question is, just what do i need to do to get this SpeechSynthesisUtterance working as expected in an Android HTML5 app.

My test device is a Samsung Galaxy S3 running the 4.3 Android update which was released very recently.


回答1:


This feature is in Chrome 33 (announcement). It is not in the Android web view so it will not work with the XDK android build or any cordova/phonegap builder. It will be available in crosswalk 5, so the XDK crosswalk android build will have it in late March when crosswalk 5 is released. See crosswalk release schedule



来源:https://stackoverflow.com/questions/22143837/speechsynthesisutterance-not-working-in-an-html5-app-built-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!