How to read the text

n my app I installed the function to read a written text.
When I run it in the browser it works correctly but when I create the app and install it on my tel wfono, this purpose does not work.
Does anyone know what I can do to make it work?

Thanks

Where is the text?

How are you accessing it?

I have the text in a textarea. The function is:

Function Button9_onclick()
  Speak(TextArea1.value)
End Function

When I execute in chrome navigator it read, but the app generates with phone gap and instaled into my phone dont read.

What am I doing wrong?

You may need to use a plugin for this:
https://cordova.apache.org/plugins/?q=speech

OK thanks.
I install text-to-speech
I modify the config.xml, I add:

plugin name=“cordova-plugin-texttospeech” source=“npm”

but, at the button, I I don’t know how to translate this text to basic languaje:

document.addEventListener(‘deviceready’, function () {

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

}, false);

I tried this:
TTS.speak(“Hello world”, MsgBox “ok”, MsgBox “error”)

but it didn’t work.

Someone know how to translate the javascript text? and how to change the languaje of the speeker, I need in spanish

Try something like this (air code). The second and third parameters should be functions:

TTS.speak("hello, world", success, fail)

Function success()
  MsgBox "It worked"
End Function

Function fail(reason)
  MsgBox "Reason"
End Function

To change the language, something like this:

parms = {text: "hello, world", locale: "es"}
TTS.speak(parms, success, fail)

It doesn’t work :worried:

I insert this code:

Function Button9_onclick()
 parms = {text: "hello, world", locale: "es", rate: 0.75}
 TTS.speak(parms, success, fail)
End Function

Function success()
  MsgBox "It worked"
End Function

Function fail(reason)
  MsgBox "Reason"
End Function

and in the config.xml I insert the line that suggested the installation (See attached image).

In my phone, when I press the play button, inmediately execute the fail function.
What is wrong?

You need to see the error message

  1. Change to this code:
Function fail(reason)
  MsgBox reason
End Function
  1. Use Chrome Remote Tools to look for messages in the Console:
    https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.