Back to Demos List

GSW Browser: cordova-plugin-tts-advanced


This plugin allows for text-to-speech.




About This Demo

This demo is using the cordova-plugin-tts-advanced plugin. For more information click here:


var GSW = GSW || {};
GSW.Tests = GSW.Tests || {};

GSW.Tests.onDeviceReady = function() {
	// Cordova is now initialized. Have fun!
	console.log('Now running cordova-' + cordova.platformId + '@' + cordova.version);
	GSW.Tests.tts = function() {
	    let text = document.getElementById("user-input").value;
          TTS
              .speak({
                text: text,
                identifier: '',  // location for specific voice, can be local or public
                rate: 1,
                pitch: 0.9,
                cancel: true
              }).then(function () {
             console.log('success');
          }, function (reason) {
            alert(reason);
          });
	}
	document.getElementById("tts").addEventListener("click", GSW.Tests.tts);
}
document.addEventListener('deviceready', GSW.Tests.onDeviceReady, false);