Ionic TTS not working

Hello, I’m new to Ionic projects and doing some few tests I ended up finding this problem. I don’t really know if is some configuration problem or a framework problem.

I have a simple page with a button that calls the textToSpeech() method.

Code:

import { Component } from ‘@angular/core’;
import {TextToSpeech} from ‘ionic-native’;
import { LoadingController } from ‘ionic-angular’;


@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})

export class HomePage {
constructor(public loadingCtrl: LoadingController) {
}

textToSpeech() {
let loader = this.loadingCtrl.create({
content: “Please wait…”,
duration: 3000
});
loader.present();

TextToSpeech.speak({
        text: "Teste em português",
        locale: 'pt-BR',
        rate: 0.75
    });
 }

}

Using the android emulator it works almost fine, despite the detail that the locale is totaly ignored and the speech is the english one reading a portuguese sentence. On my device (Moto-play with the ionic view app) it doesn’t work at all, I click in the button and there is no sound.

Can I have some help with it?

Ionic View only supports a limited number of built-in plugins: https://docs.ionic.io/tools/view/#supported-plugins
If you want to test on your device, you should build your own .apk that you also tested in the emulator.

Oh, glad to know it.
Really thank you.

But the problem with the locale, any idea?

Hi,
I am trying to use TTS.tts and passing a long string approx 5000 charecters but it it not speaking while shrten the string with less then 4000 charetcerts, it is speaking the text.

$scope.speakText = function(text) {
console.log(text);
console.log($scope.data[text]);
$scope.showSpeakBtn = false;
$scope.showStopBtn = true;

if (window.cordova) {
TTS.speak({
text: $scope.data[text],
locale: ‘en-US’,
rate: 1.0
}, function () {

   // Do Something after success

}, function (reason) {
// Handle the error case
});
}
}

Please suggest how to resolve this.

Is your topic in the right category? that looks like ionic >= 2 to me.

If im right please change the category of this topic to Ionic.