1

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.

cptdanko
  • 812
  • 2
  • 13
  • 22
  • Which android api version are you using? – fredrik Mar 03 '14 at 10:24
  • Intel XDK, is purely Javascript and HTML. it has a build feature which builds your app into a native binary for you. This can be for anything i.e. ios, Android, WP8 etc – cptdanko Mar 03 '14 at 10:28
  • Question still remains. If you're building agains old API version you might not have that function implemented in the browser used in the app. Also I've read that the speech synthesis was just recently released on google crome beta channel, which would mean that it probably is not available in apps yet. – fredrik Mar 03 '14 at 10:32
  • Fair enough, so i just checked and i reckon it is building it for Android 4.0. – cptdanko Mar 03 '14 at 10:51
  • On Android 4.0 it still doesn't use Chrome as default browser in apps, even if you have it installed and selected it as default (because that default only refers to Intents). You have to find some way to use Chrome explicitly. – fredrik Mar 03 '14 at 12:27
  • I have never used XDK, but in phonegap you have an SpeechSynthesis plugin, not sure if you can create plugins for XDK – jcesarmobile Mar 05 '14 at 07:57

1 Answers1

0

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

rscohn2
  • 899
  • 7
  • 10
  • there are some issues with the API on Crosswalk, see https://crosswalk-project.org/jira/browse/XWALK-1105 – hypery2k May 05 '15 at 05:41