@capacitor-community/text-to-speech 1.0.0 → 1.1.2-dev.aaa3396.1649088226

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,17 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = 'CapacitorCommunityTextToSpeech'
7
- s.version = package['version']
8
- s.summary = package['description']
9
- s.license = package['license']
10
- s.homepage = package['repository']['url']
11
- s.author = package['author']
12
- s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
15
- s.dependency 'Capacitor'
16
- s.swift_version = '5.1'
17
- end
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapacitorCommunityTextToSpeech'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '12.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Robin Genz
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Robin Genz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,119 +1,104 @@
1
- <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>
2
- <h3 align="center">Text to Speech</h3>
3
- <p align="center"><strong><code>@capacitor-community/text-to-speech</code></strong></p>
4
- <p align="center">
5
- Capacitor community plugin for synthesizing speech from text.
6
- </p>
7
-
8
- <p align="center">
9
- <img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" />
10
- <a href="https://github.com/capacitor-community/text-to-speech/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/text-to-speech/CI/master?style=flat-square" /></a>
11
- <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/l/@capacitor-community/text-to-speech?style=flat-square" /></a>
12
- <br>
13
- <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/dw/@capacitor-community/text-to-speech?style=flat-square" /></a>
14
- <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/v/@capacitor-community/text-to-speech?style=flat-square" /></a>
15
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
16
- <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-1-orange?style=flat-square" /></a>
17
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
18
- </p>
19
-
20
- ## Maintainers
21
-
22
- | Maintainer | GitHub | Social |
23
- | ---------- | ----------------------------------------- | --------------------------------------------- |
24
- | Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |
25
-
26
- ## Installation
27
-
28
- ### Capacitor 3.x
29
-
30
- ```
31
- npm install @capacitor-community/text-to-speech
32
- npx cap sync
33
- ```
34
-
35
- ### Capacitor 2.x
36
-
37
- ```
38
- npm install @capacitor-community/text-to-speech@0.2.3
39
- npx cap sync
40
- ```
41
-
42
- On **iOS**, no further steps are needed.
43
-
44
- On **Android**, register the plugin in your main activity:
45
-
46
- ```java
47
- import com.getcapacitor.community.tts.TextToSpeech;
48
-
49
- public class MainActivity extends BridgeActivity {
50
-
51
- @Override
52
- public void onCreate(Bundle savedInstanceState) {
53
- super.onCreate(savedInstanceState);
54
-
55
- // Initializes the Bridge
56
- this.init(
57
- savedInstanceState,
58
- new ArrayList<Class<? extends Plugin>>() {
59
- {
60
- // Additional plugins you've installed go here
61
- // Ex: add(TotallyAwesomePlugin.class);
62
- add(TextToSpeech.class);
63
- }
64
- }
65
- );
66
- }
67
- }
68
-
69
- ```
70
-
71
- ## Configuration
72
-
73
- No configuration required for this plugin.
74
-
75
- ## Usage
76
-
77
- ```typescript
78
- import { TextToSpeech } from '@capacitor-community/text-to-speech';
79
-
80
- const speak = async () => {
81
- await TextToSpeech.speak({
82
- text: 'This is a sample text.',
83
- lang: 'en_US',
84
- rate: 1.0,
85
- pitch: 1.0,
86
- volume: 1.0,
87
- category: 'ambient',
88
- });
89
- };
90
-
91
- const stop = async () => {
92
- await TextToSpeech.stop();
93
- };
94
-
95
- const getSupportedLanguages = async () => {
96
- const languages = await TextToSpeech.getSupportedLanguages();
97
- };
98
-
99
- const getSupportedVoices = async () => {
100
- const voices = await TextToSpeech.getSupportedVoices();
101
- };
102
- ```
103
-
104
- ## API
105
-
1
+ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>
2
+ <h3 align="center">Text to Speech</h3>
3
+ <p align="center"><strong><code>@capacitor-community/text-to-speech</code></strong></p>
4
+ <p align="center">
5
+ Capacitor community plugin for synthesizing speech from text.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <img src="https://img.shields.io/maintenance/yes/2022?style=flat-square" />
10
+ <a href="https://github.com/capacitor-community/text-to-speech/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/text-to-speech/CI/master?style=flat-square" /></a>
11
+ <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/l/@capacitor-community/text-to-speech?style=flat-square" /></a>
12
+ <br>
13
+ <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/dw/@capacitor-community/text-to-speech?style=flat-square" /></a>
14
+ <a href="https://www.npmjs.com/package/@capacitor-community/text-to-speech"><img src="https://img.shields.io/npm/v/@capacitor-community/text-to-speech?style=flat-square" /></a>
15
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
16
+ <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-1-orange?style=flat-square" /></a>
17
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
18
+ </p>
19
+
20
+ ## Maintainers
21
+
22
+ | Maintainer | GitHub | Social |
23
+ | ---------- | ----------------------------------------- | --------------------------------------------- |
24
+ | Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |
25
+
26
+ ## Installation
27
+
28
+ ```
29
+ npm install @capacitor-community/text-to-speech
30
+ npx cap sync
31
+ ```
32
+
33
+ ### Android
34
+
35
+ According to the [Android documentation](https://developer.android.com/reference/android/speech/tts/TextToSpeech), apps targeting **Android 11** should declare [TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE](https://developer.android.com/reference/android/speech/tts/TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE) in the queries elements of their manifest:
36
+
37
+ ```xml
38
+ <queries>
39
+ <intent>
40
+ <action android:name="android.intent.action.TTS_SERVICE" />
41
+ </intent>
42
+ </queries>
43
+ ```
44
+
45
+ [Here](https://github.com/robingenz/capacitor-plugin-demo/commit/b7dc6c6d6652be9356d354df1faeb6a40e442797) you can find an example commit.
46
+
47
+ ## Configuration
48
+
49
+ No configuration required for this plugin.
50
+
51
+ ## Demo
52
+
53
+ A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)
54
+
55
+ ## Usage
56
+
57
+ ```typescript
58
+ import { TextToSpeech } from '@capacitor-community/text-to-speech';
59
+
60
+ const speak = async () => {
61
+ await TextToSpeech.speak({
62
+ text: 'This is a sample text.',
63
+ lang: 'en-US',
64
+ rate: 1.0,
65
+ pitch: 1.0,
66
+ volume: 1.0,
67
+ category: 'ambient',
68
+ });
69
+ };
70
+
71
+ const stop = async () => {
72
+ await TextToSpeech.stop();
73
+ };
74
+
75
+ const getSupportedLanguages = async () => {
76
+ const languages = await TextToSpeech.getSupportedLanguages();
77
+ };
78
+
79
+ const getSupportedVoices = async () => {
80
+ const voices = await TextToSpeech.getSupportedVoices();
81
+ };
82
+
83
+ const isLanguageSupported = async (lang: string) => {
84
+ const isSupported = await TextToSpeech.isLanguageSupported({ lang });
85
+ };
86
+ ```
87
+
88
+ ## API
89
+
106
90
  <docgen-index>
107
91
 
108
92
  * [`speak(...)`](#speak)
109
93
  * [`stop()`](#stop)
110
94
  * [`getSupportedLanguages()`](#getsupportedlanguages)
111
95
  * [`getSupportedVoices()`](#getsupportedvoices)
96
+ * [`isLanguageSupported(...)`](#islanguagesupported)
112
97
  * [`openInstall()`](#openinstall)
113
98
  * [Interfaces](#interfaces)
114
99
 
115
- </docgen-index>
116
-
100
+ </docgen-index>
101
+
117
102
  <docgen-api>
118
103
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
119
104
 
@@ -149,7 +134,7 @@ Stops the TTS engine.
149
134
  getSupportedLanguages() => Promise<{ languages: string[]; }>
150
135
  ```
151
136
 
152
- Returns a list of supported languages.
137
+ Returns a list of supported BCP 47 language tags.
153
138
 
154
139
  **Returns:** <code>Promise&lt;{ languages: string[]; }&gt;</code>
155
140
 
@@ -169,14 +154,31 @@ Returns a list of supported voices.
169
154
  --------------------
170
155
 
171
156
 
157
+ ### isLanguageSupported(...)
158
+
159
+ ```typescript
160
+ isLanguageSupported(options: { lang: string; }) => Promise<{ supported: boolean; }>
161
+ ```
162
+
163
+ Checks if a specific BCP 47 language tag is supported.
164
+
165
+ | Param | Type |
166
+ | ------------- | ------------------------------ |
167
+ | **`options`** | <code>{ lang: string; }</code> |
168
+
169
+ **Returns:** <code>Promise&lt;{ supported: boolean; }&gt;</code>
170
+
171
+ --------------------
172
+
173
+
172
174
  ### openInstall()
173
175
 
174
176
  ```typescript
175
177
  openInstall() => Promise<void>
176
178
  ```
177
179
 
178
- Verifies proper installation and availability of resource files on the system.
179
-
180
+ Verifies proper installation and availability of resource files on the system.
181
+
180
182
  Only available for Android.
181
183
 
182
184
  --------------------
@@ -210,12 +212,12 @@ The <a href="#speechsynthesisvoice">SpeechSynthesisVoice</a> interface represent
210
212
  | **`name`** | <code>string</code> | Human-readable name that represents the voice. Example: `Microsoft Zira Desktop - English (United States)`. |
211
213
  | **`voiceURI`** | <code>string</code> | Type of URI and location of the speech synthesis service for this voice. Example: `urn:moz-tts:sapi:Microsoft Zira Desktop - English (United States)?en-US`. |
212
214
 
213
- </docgen-api>
214
-
215
- ## Changelog
216
-
217
- See [CHANGELOG.md](https://github.com/capacitor-community/text-to-speech/blob/master/CHANGELOG.md).
218
-
219
- ## License
220
-
221
- See [LICENSE](https://github.com/capacitor-community/text-to-speech/blob/master/LICENSE).
215
+ </docgen-api>
216
+
217
+ ## Changelog
218
+
219
+ See [CHANGELOG.md](https://github.com/capacitor-community/text-to-speech/blob/master/CHANGELOG.md).
220
+
221
+ ## License
222
+
223
+ See [LICENSE](https://github.com/capacitor-community/text-to-speech/blob/master/LICENSE).
@@ -1,58 +1,58 @@
1
- ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
6
- }
7
-
8
- buildscript {
9
- repositories {
10
- google()
11
- jcenter()
12
- }
13
- dependencies {
14
- classpath 'com.android.tools.build:gradle:4.1.2'
15
- }
16
- }
17
-
18
- apply plugin: 'com.android.library'
19
-
20
- android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
22
- defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
25
- versionCode 1
26
- versionName "1.0"
27
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28
- }
29
- buildTypes {
30
- release {
31
- minifyEnabled false
32
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33
- }
34
- }
35
- lintOptions {
36
- abortOnError false
37
- }
38
- compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
41
- }
42
- }
43
-
44
- repositories {
45
- google()
46
- jcenter()
47
- mavenCentral()
48
- }
49
-
50
-
51
- dependencies {
52
- implementation fileTree(dir: 'libs', include: ['*.jar'])
53
- implementation project(':capacitor-android')
54
- implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
- testImplementation "junit:junit:$junitVersion"
56
- androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
- androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
- }
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:4.2.1'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
22
+ defaultConfig {
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
25
+ versionCode 1
26
+ versionName "1.0"
27
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28
+ }
29
+ buildTypes {
30
+ release {
31
+ minifyEnabled false
32
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33
+ }
34
+ }
35
+ lintOptions {
36
+ abortOnError false
37
+ }
38
+ compileOptions {
39
+ sourceCompatibility JavaVersion.VERSION_1_8
40
+ targetCompatibility JavaVersion.VERSION_1_8
41
+ }
42
+ }
43
+
44
+ repositories {
45
+ google()
46
+ mavenCentral()
47
+ jcenter()
48
+ }
49
+
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ testImplementation "junit:junit:$junitVersion"
56
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ }
@@ -1,3 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.getcapacitor.community.tts">
3
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.getcapacitor.community.tts">
3
+ </manifest>
@@ -1,6 +1,6 @@
1
- package com.getcapacitor.community.tts;
2
-
3
- public interface SpeakResultCallback {
4
- void onDone();
5
- void onError();
6
- }
1
+ package com.getcapacitor.community.tts;
2
+
3
+ public interface SpeakResultCallback {
4
+ void onDone();
5
+ void onError();
6
+ }