Code example for TextToSpeech

Methods: getLanguage

0
		 
	@Kroll.method 
	public boolean isSpeaking() { 
		Log.d(LCAT, "isSpeaking" );
		if (initialized) {
			return tts.isSpeaking();
		} 
		return false; 
	} 
	 
	@Kroll.method 
	public boolean speak(String text, @Kroll.argument(optional = true) String utteranceId) {
		Log.d(LCAT, "speak " + text);
		if (initialized) {
			if (0 < text.length()) {
				if (tts.setPitch(getPitch()) == TextToSpeech.ERROR) {
					Log.e("TTS", "Ptich(" + getPitch() + ") set error.");
				} 
				if (tts.setSpeechRate(getRate()) == TextToSpeech.ERROR) {
					Log.e("TTS", "Speech rate(" + getRate() + ") set error.");
				}