@capacitor-community/text-to-speech 2.0.0 → 2.1.0

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 = '13.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,92 +1,92 @@
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
-
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/2023?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/actions/workflow/status/capacitor-community/text-to-speech/ci.yml?branch=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
+
90
90
  <docgen-index>
91
91
 
92
92
  * [`speak(...)`](#speak)
@@ -97,8 +97,8 @@ const isLanguageSupported = async (lang: string) => {
97
97
  * [`openInstall()`](#openinstall)
98
98
  * [Interfaces](#interfaces)
99
99
 
100
- </docgen-index>
101
-
100
+ </docgen-index>
101
+
102
102
  <docgen-api>
103
103
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
104
104
 
@@ -177,8 +177,8 @@ Checks if a specific BCP 47 language tag is supported.
177
177
  openInstall() => Promise<void>
178
178
  ```
179
179
 
180
- Verifies proper installation and availability of resource files on the system.
181
-
180
+ Verifies proper installation and availability of resource files on the system.
181
+
182
182
  Only available for Android.
183
183
 
184
184
  --------------------
@@ -189,35 +189,35 @@ Only available for Android.
189
189
 
190
190
  #### TTSOptions
191
191
 
192
- | Prop | Type | Description |
193
- | -------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
194
- | **`text`** | <code>string</code> | The text that will be synthesised when the utterance is spoken. |
195
- | **`lang`** | <code>string</code> | The language of the utterance. Possible languages can be queried using `getSupportedLanguages`. Default: `en-US`. |
196
- | **`rate`** | <code>number</code> | The speed at which the utterance will be spoken at. Default: `1.0`. |
197
- | **`pitch`** | <code>number</code> | The pitch at which the utterance will be spoken at. Default: `1.0`. |
198
- | **`volume`** | <code>number</code> | The volume that the utterance will be spoken at. Default: `1.0`. |
199
- | **`voice`** | <code>number</code> | The index of the selected voice that will be used to speak the utterance. Possible voices can be queried using `getSupportedVoices`. Only available for Web. |
200
- | **`category`** | <code>string</code> | Select the iOS Audio session category. Possible values: `ambient` and `playback`. Use `playback` to play audio even when the app is in the background. Only available for iOS. Default: `ambient`. |
192
+ | Prop | Type | Description | Default |
193
+ | -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- |
194
+ | **`text`** | <code>string</code> | The text that will be synthesised when the utterance is spoken. | |
195
+ | **`lang`** | <code>string</code> | The language of the utterance. Possible languages can be queried using `getSupportedLanguages`. | <code>"en-US"</code> |
196
+ | **`rate`** | <code>number</code> | The speed at which the utterance will be spoken at. | <code>1.0</code> |
197
+ | **`pitch`** | <code>number</code> | The pitch at which the utterance will be spoken at. | <code>1.0</code> |
198
+ | **`volume`** | <code>number</code> | The volume that the utterance will be spoken at. | <code>1.0</code> |
199
+ | **`voice`** | <code>number</code> | The index of the selected voice that will be used to speak the utterance. Possible voices can be queried using `getSupportedVoices`. | |
200
+ | **`category`** | <code>string</code> | Select the iOS Audio session category. Possible values: `ambient` and `playback`. Use `playback` to play audio even when the app is in the background. Only available for iOS. | <code>"ambient"</code> |
201
201
 
202
202
 
203
203
  #### SpeechSynthesisVoice
204
204
 
205
205
  The <a href="#speechsynthesisvoice">SpeechSynthesisVoice</a> interface represents a voice that the system supports.
206
206
 
207
- | Prop | Type | Description |
208
- | ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
209
- | **`default`** | <code>boolean</code> | Specifies whether the voice is the default voice for the current app (`true`) or not (`false`). |
210
- | **`lang`** | <code>string</code> | BCP 47 language tag indicating the language of the voice. Example: `en-US`. |
211
- | **`localService`** | <code>boolean</code> | Specifies whether the voice is supplied by a local (`true`) or remote (`false`) speech synthesizer service. |
212
- | **`name`** | <code>string</code> | Human-readable name that represents the voice. Example: `Microsoft Zira Desktop - English (United States)`. |
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`. |
214
-
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).
207
+ | Prop | Type | Description |
208
+ | ------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------- |
209
+ | **`default`** | <code>boolean</code> | Specifies whether the voice is the default voice for the current app (`true`) or not (`false`). |
210
+ | **`lang`** | <code>string</code> | BCP 47 language tag indicating the language of the voice. |
211
+ | **`localService`** | <code>boolean</code> | Specifies whether the voice is supplied by a local (`true`) or remote (`false`) speech synthesizer service. |
212
+ | **`name`** | <code>string</code> | Human-readable name that represents the voice. |
213
+ | **`voiceURI`** | <code>string</code> | Type of URI and location of the speech synthesis service for this voice. |
214
+
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,57 +1,57 @@
1
- ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
- }
7
-
8
- buildscript {
9
- repositories {
10
- google()
11
- mavenCentral()
12
- }
13
- dependencies {
14
- classpath 'com.android.tools.build:gradle:7.2.1'
15
- }
16
- }
17
-
18
- apply plugin: 'com.android.library'
19
-
20
- android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
- defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
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_11
40
- targetCompatibility JavaVersion.VERSION_11
41
- }
42
- }
43
-
44
- repositories {
45
- google()
46
- mavenCentral()
47
- }
48
-
49
-
50
- dependencies {
51
- implementation fileTree(dir: 'libs', include: ['*.jar'])
52
- implementation project(':capacitor-android')
53
- implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
54
- testImplementation "junit:junit:$junitVersion"
55
- androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
56
- androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
57
- }
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
+ defaultConfig {
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
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_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
+ }
42
+ }
43
+
44
+ repositories {
45
+ google()
46
+ mavenCentral()
47
+ }
48
+
49
+
50
+ dependencies {
51
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
52
+ implementation project(':capacitor-android')
53
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
54
+ testImplementation "junit:junit:$junitVersion"
55
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
56
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
57
+ }
@@ -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
+ }