W3C Web Speech API - Speech synthesis plugin for PhoneGap
Java JavaScript
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.github πŸ“ Update Issue Template Nov 30, 2017
spec/helper βœ… adding w3c spec tests Jun 1, 2017
src/android
www πŸ› Issue #6: SpeechSynthesisUtterance constructor takes an argument Mar 27, 2018
.editorconfig Add editorconfig and jshintrc Jun 8, 2016
.gitignore πŸ”§ add node_modules to .gitignore Jun 1, 2017
.jshintrc Add editorconfig and jshintrc Jun 8, 2016
CHANGELOG.md πŸ”§ add changelog Jun 1, 2017
LICENSE Initial commit Jul 18, 2013
README.md
package-lock.json βž• add jasmine Jun 1, 2017
package.json 0.1.1 Jun 1, 2017
plugin.xml πŸ”– Bumping plugin version to 0.1.1 Jun 1, 2017

README.md

SpeechSynthesisPlugin

W3C Web Speech API - Speech synthesis plugin for PhoneGap

Installation

Phone Gap

Using the command line tools run:

phonegap plugin add https://github.com/macdonst/SpeechSynthesisPlugin
cordova plugin add https://github.com/macdonst/SpeechSynthesisPlugin

Cordova

This plugin also works with the Apache Cordova toolset. See this Github project for an example for Android:

https://github.com/andysylvester/talk-to-me-cordova

More info on using this plugin with Cordova is available at this blog post.

Example Code

This code from the above Github project shows how to read the value of a text field, set up the plugin to speak that text, and vibrate the phone for 2 seconds:

 function playVibrate() {
    var u = new SpeechSynthesisUtterance();
    var x = document.getElementById("frm1");
    var txt = "";
    txt = x.elements[0].value
    u.text = txt;
    u.lang = 'en-US';
    speechSynthesis.speak(u);      
    navigator.notification.vibrate(2000);
    document.getElementById("frm1").reset();
  }