diff --git a/README.md b/README.md
index 3c1d18c..bf324b1 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,17 @@
-#SpeechSynthesisPlugin
+# SpeechSynthesisPlugin
W3C Web Speech API - Speech synthesis plugin for PhoneGap
-#Installation
+# Installation
-##Phone Gap
+## 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
+## Cordova
This plugin also works with the Apache Cordova toolset. See this Github project for an example for Android:
@@ -20,7 +20,7 @@ This plugin also works with the Apache Cordova toolset. See this Github project
More info on using this plugin with Cordova is available at this blog post.
-#Example Code
+# 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:
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..22ddac8
--- /dev/null
+++ b/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "phonegap-plugin-speech-synthesis",
+ "version": "0.1.0",
+ "description": "W3C Web Speech API - Speech synthesis plugin for PhoneGap",
+ "homepage": "https://github.com/macdonst/SpeechSynthesisPlugin#readme",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/macdonst/SpeechSynthesisPlugin.git"
+ },
+ "bugs": {
+ "url": "https://github.com/macdonst/SpeechSynthesisPlugin/issues"
+ },
+ "cordova": {
+ "id": "phonegap-plugin-speech-synthesis",
+ "platforms": [
+ "ios",
+ "android",
+ "browser"
+ ]
+ },
+ "keywords": [
+ "ecosystem:cordova",
+ "ecosystem:phonegap",
+ "cordova-ios",
+ "cordova-android",
+ "cordova-browser"
+ ],
+ "author": "Simon MacDonald",
+ "license": "MIT"
+}
diff --git a/plugin.xml b/plugin.xml
index 7775065..8576c85 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,7 +1,7 @@
SpeechSynthesis
Cordova Speech Synthesis Plugin
@@ -38,5 +38,5 @@
-
+
diff --git a/src/android/SpeechSynthesis.java b/src/android/SpeechSynthesis.java
index 842c492..cfa0406 100644
--- a/src/android/SpeechSynthesis.java
+++ b/src/android/SpeechSynthesis.java
@@ -253,7 +253,7 @@ private boolean isReady() {
* @param status
*/
public void onInit(int status) {
- if (status == TextToSpeech.SUCCESS) {
+ if (mTts != null && status == TextToSpeech.SUCCESS) {
state = SpeechSynthesis.STARTED;
getVoices(this.startupCallbackContext);
diff --git a/www/SpeechSynthesis.js b/www/SpeechSynthesis.js
index dc53608..dde4398 100644
--- a/www/SpeechSynthesis.js
+++ b/www/SpeechSynthesis.js
@@ -1,6 +1,6 @@
var exec = require("cordova/exec");
-var SpeechSynthesisVoiceList = require("org.apache.cordova.speech.speechsynthesis.SpeechSynthesisVoiceList");
+var SpeechSynthesisVoiceList = require("./SpeechSynthesisVoiceList");
var SpeechSynthesis = function() {
this.pending = false;
@@ -55,8 +55,4 @@ SpeechSynthesis.prototype.getVoices = function() {
return this._voices;
};
-SpeechSynthesis.prototype.silence = function (milliseconds) {
- exec(null, null, "SpeechSynthesis", "silence", [milliseconds]);
-};
-
module.exports = new SpeechSynthesis();