简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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