From 7b54aa8de2ead13bfdb0328c61ce057c5727a87f Mon Sep 17 00:00:00 2001 From: Thibault Durand Date: Fri, 14 Mar 2014 11:48:06 +0100 Subject: [PATCH 1/4] Fix: Crash if TextToSpeech not defined TextToSpeech may be undefined and still call onInit, this provide a safe call. (overwise it crash the app) --- src/android/SpeechSynthesis.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/SpeechSynthesis.java b/src/android/SpeechSynthesis.java index 1815325..ca6ceb0 100644 --- a/src/android/SpeechSynthesis.java +++ b/src/android/SpeechSynthesis.java @@ -183,7 +183,7 @@ private boolean isReady() { * @param status */ public void onInit(int status) { - if (status == TextToSpeech.SUCCESS) { + if (mTts != null && status == TextToSpeech.SUCCESS) { state = SpeechSynthesis.STARTED; JSONArray voices = new JSONArray(); JSONObject voice; @@ -259,4 +259,4 @@ public void onDestroy() { public void onUtteranceCompleted(String utteranceId) { fireEndEvent(callbackContext); } -} \ No newline at end of file +} From cb97e101210dd1d64652893c99c82f62587bd25a Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 19 Apr 2017 14:06:33 +0200 Subject: [PATCH 2/4] fix headlines --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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: From 3e4dde25df72f651810b4c2a66524ebee64d59d3 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Thu, 1 Jun 2017 10:10:56 -0400 Subject: [PATCH 3/4] :wrench: Create package.json --- package.json | 33 +++++++++++++++++++++++++++++++++ plugin.xml | 4 ++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 package.json 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 @@ - + From d5601ac8989803d213aea3988ef206d885e0248b Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Thu, 1 Jun 2017 10:51:21 -0400 Subject: [PATCH 4/4] :bug: Fix import of voice list --- www/SpeechSynthesis.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/SpeechSynthesis.js b/www/SpeechSynthesis.js index 826b4ff..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,4 +55,4 @@ SpeechSynthesis.prototype.getVoices = function() { return this._voices; }; -module.exports = new SpeechSynthesis(); \ No newline at end of file +module.exports = new SpeechSynthesis();