@capgo/capacitor-speech-synthesis 7.0.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.
- package/CapgoCapacitorSpeechSynthesis.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +507 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/ee/forgr/plugin/speechsynthesis/SpeechSynthesisPlugin.java +438 -0
- package/dist/docs.json +1089 -0
- package/dist/esm/definitions.d.ts +519 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +35 -0
- package/dist/esm/web.js +153 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +167 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +170 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/SpeechSynthesisPlugin/SpeechSynthesisPlugin.swift +338 -0
- package/ios/Tests/SpeechSynthesisPluginTests/SpeechSynthesisPluginTests.swift +10 -0
- package/package.json +86 -0
|
@@ -0,0 +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 = 'CapgoCapacitorSpeechSynthesis'
|
|
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/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.1'
|
|
17
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Martin Donadieu
|
|
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/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapgoCapacitorSpeechSynthesis",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapgoCapacitorSpeechSynthesis",
|
|
10
|
+
targets: ["SpeechSynthesisPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "SpeechSynthesisPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/SpeechSynthesisPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "SpeechSynthesisPluginTests",
|
|
25
|
+
dependencies: ["SpeechSynthesisPlugin"],
|
|
26
|
+
path: "ios/Tests/SpeechSynthesisPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
# @capgo/capacitor-speech-synthesis
|
|
2
|
+
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
|
|
3
|
+
|
|
4
|
+
<div align="center">
|
|
5
|
+
<h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo</a></h2>
|
|
6
|
+
<h2><a href="https://capgo.app/consulting/?ref=plugin"> Missing a feature? We'll build the plugin for you 💪</a></h2>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
Synthesize speech from text with full control over language, voice, pitch, rate, and volume.
|
|
10
|
+
|
|
11
|
+
## Why Speech Synthesis?
|
|
12
|
+
|
|
13
|
+
A free, open-source alternative providing complete text-to-speech capabilities:
|
|
14
|
+
|
|
15
|
+
- **Cross-platform** - Works on iOS, Android, and Web with consistent API
|
|
16
|
+
- **Full voice control** - Choose from system voices, adjust pitch, rate, and volume
|
|
17
|
+
- **Event-driven** - Listen to speech events (start, end, word boundaries, errors)
|
|
18
|
+
- **File export** - Save speech to audio files on iOS and Android
|
|
19
|
+
- **Modern APIs** - Uses AVSpeechSynthesizer (iOS), TextToSpeech (Android), and Web Speech API
|
|
20
|
+
- **Production-ready** - Complete TypeScript support with comprehensive documentation
|
|
21
|
+
|
|
22
|
+
Perfect for accessibility features, language learning apps, audiobook players, and any app needing text-to-speech.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @capgo/capacitor-speech-synthesis
|
|
28
|
+
npx cap sync
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
<docgen-index>
|
|
34
|
+
|
|
35
|
+
* [`speak(...)`](#speak)
|
|
36
|
+
* [`synthesizeToFile(...)`](#synthesizetofile)
|
|
37
|
+
* [`cancel()`](#cancel)
|
|
38
|
+
* [`pause()`](#pause)
|
|
39
|
+
* [`resume()`](#resume)
|
|
40
|
+
* [`isSpeaking()`](#isspeaking)
|
|
41
|
+
* [`isAvailable()`](#isavailable)
|
|
42
|
+
* [`getVoices()`](#getvoices)
|
|
43
|
+
* [`getLanguages()`](#getlanguages)
|
|
44
|
+
* [`isLanguageAvailable(...)`](#islanguageavailable)
|
|
45
|
+
* [`isVoiceAvailable(...)`](#isvoiceavailable)
|
|
46
|
+
* [`initialize()`](#initialize)
|
|
47
|
+
* [`activateAudioSession(...)`](#activateaudiosession)
|
|
48
|
+
* [`deactivateAudioSession()`](#deactivateaudiosession)
|
|
49
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
50
|
+
* [`addListener('start', ...)`](#addlistenerstart-)
|
|
51
|
+
* [`addListener('end', ...)`](#addlistenerend-)
|
|
52
|
+
* [`addListener('boundary', ...)`](#addlistenerboundary-)
|
|
53
|
+
* [`addListener('error', ...)`](#addlistenererror-)
|
|
54
|
+
* [`removeAllListeners()`](#removealllisteners)
|
|
55
|
+
* [Interfaces](#interfaces)
|
|
56
|
+
|
|
57
|
+
</docgen-index>
|
|
58
|
+
|
|
59
|
+
<docgen-api>
|
|
60
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
61
|
+
|
|
62
|
+
Speech Synthesis Plugin for synthesizing speech from text.
|
|
63
|
+
|
|
64
|
+
### speak(...)
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
speak(options: SpeakOptions) => Promise<SpeakResult>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Speaks the given text with specified options.
|
|
71
|
+
The utterance is added to the speech queue.
|
|
72
|
+
|
|
73
|
+
| Param | Type | Description |
|
|
74
|
+
| ------------- | ----------------------------------------------------- | ------------------------------------------------------ |
|
|
75
|
+
| **`options`** | <code><a href="#speakoptions">SpeakOptions</a></code> | - The speech options including text and voice settings |
|
|
76
|
+
|
|
77
|
+
**Returns:** <code>Promise<<a href="#speakresult">SpeakResult</a>></code>
|
|
78
|
+
|
|
79
|
+
**Since:** 1.0.0
|
|
80
|
+
|
|
81
|
+
--------------------
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### synthesizeToFile(...)
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
synthesizeToFile(options: SpeakOptions) => Promise<SynthesizeToFileResult>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Synthesizes speech to an audio file (Android/iOS only).
|
|
91
|
+
Returns the file path where the audio was saved.
|
|
92
|
+
|
|
93
|
+
| Param | Type | Description |
|
|
94
|
+
| ------------- | ----------------------------------------------------- | ------------------------------------------------------ |
|
|
95
|
+
| **`options`** | <code><a href="#speakoptions">SpeakOptions</a></code> | - The speech options including text and voice settings |
|
|
96
|
+
|
|
97
|
+
**Returns:** <code>Promise<<a href="#synthesizetofileresult">SynthesizeToFileResult</a>></code>
|
|
98
|
+
|
|
99
|
+
**Since:** 1.0.0
|
|
100
|
+
|
|
101
|
+
--------------------
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### cancel()
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
cancel() => Promise<void>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Cancels all queued utterances and stops current speech.
|
|
111
|
+
|
|
112
|
+
**Since:** 1.0.0
|
|
113
|
+
|
|
114
|
+
--------------------
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### pause()
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
pause() => Promise<void>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Pauses speech immediately.
|
|
124
|
+
|
|
125
|
+
**Since:** 1.0.0
|
|
126
|
+
|
|
127
|
+
--------------------
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### resume()
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
resume() => Promise<void>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Resumes paused speech.
|
|
137
|
+
|
|
138
|
+
**Since:** 1.0.0
|
|
139
|
+
|
|
140
|
+
--------------------
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### isSpeaking()
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
isSpeaking() => Promise<{ isSpeaking: boolean; }>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Checks if speech synthesis is currently speaking.
|
|
150
|
+
|
|
151
|
+
**Returns:** <code>Promise<{ isSpeaking: boolean; }></code>
|
|
152
|
+
|
|
153
|
+
**Since:** 1.0.0
|
|
154
|
+
|
|
155
|
+
--------------------
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### isAvailable()
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
isAvailable() => Promise<{ isAvailable: boolean; }>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Checks if speech synthesis is available on the device.
|
|
165
|
+
|
|
166
|
+
**Returns:** <code>Promise<{ isAvailable: boolean; }></code>
|
|
167
|
+
|
|
168
|
+
**Since:** 1.0.0
|
|
169
|
+
|
|
170
|
+
--------------------
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
### getVoices()
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
getVoices() => Promise<{ voices: VoiceInfo[]; }>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Gets all available voices.
|
|
180
|
+
|
|
181
|
+
**Returns:** <code>Promise<{ voices: VoiceInfo[]; }></code>
|
|
182
|
+
|
|
183
|
+
**Since:** 1.0.0
|
|
184
|
+
|
|
185
|
+
--------------------
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### getLanguages()
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
getLanguages() => Promise<{ languages: string[]; }>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Gets all available languages.
|
|
195
|
+
|
|
196
|
+
**Returns:** <code>Promise<{ languages: string[]; }></code>
|
|
197
|
+
|
|
198
|
+
**Since:** 1.0.0
|
|
199
|
+
|
|
200
|
+
--------------------
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### isLanguageAvailable(...)
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
isLanguageAvailable(options: IsLanguageAvailableOptions) => Promise<{ isAvailable: boolean; }>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Checks if a specific language is available.
|
|
210
|
+
|
|
211
|
+
| Param | Type | Description |
|
|
212
|
+
| ------------- | --------------------------------------------------------------------------------- | ----------------------- |
|
|
213
|
+
| **`options`** | <code><a href="#islanguageavailableoptions">IsLanguageAvailableOptions</a></code> | - The language to check |
|
|
214
|
+
|
|
215
|
+
**Returns:** <code>Promise<{ isAvailable: boolean; }></code>
|
|
216
|
+
|
|
217
|
+
**Since:** 1.0.0
|
|
218
|
+
|
|
219
|
+
--------------------
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
### isVoiceAvailable(...)
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
isVoiceAvailable(options: IsVoiceAvailableOptions) => Promise<{ isAvailable: boolean; }>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Checks if a specific voice is available.
|
|
229
|
+
|
|
230
|
+
| Param | Type | Description |
|
|
231
|
+
| ------------- | --------------------------------------------------------------------------- | ----------------------- |
|
|
232
|
+
| **`options`** | <code><a href="#isvoiceavailableoptions">IsVoiceAvailableOptions</a></code> | - The voice ID to check |
|
|
233
|
+
|
|
234
|
+
**Returns:** <code>Promise<{ isAvailable: boolean; }></code>
|
|
235
|
+
|
|
236
|
+
**Since:** 1.0.0
|
|
237
|
+
|
|
238
|
+
--------------------
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
### initialize()
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
initialize() => Promise<void>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Initializes the speech synthesis engine (iOS optimization).
|
|
248
|
+
This can reduce latency for the first speech request.
|
|
249
|
+
|
|
250
|
+
**Since:** 1.0.0
|
|
251
|
+
|
|
252
|
+
--------------------
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
### activateAudioSession(...)
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
activateAudioSession(options: ActivateAudioSessionOptions) => Promise<void>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Activates the audio session with a specific category (iOS only).
|
|
262
|
+
|
|
263
|
+
| Param | Type | Description |
|
|
264
|
+
| ------------- | ----------------------------------------------------------------------------------- | ---------------------------- |
|
|
265
|
+
| **`options`** | <code><a href="#activateaudiosessionoptions">ActivateAudioSessionOptions</a></code> | - The audio session category |
|
|
266
|
+
|
|
267
|
+
**Since:** 1.0.0
|
|
268
|
+
|
|
269
|
+
--------------------
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
### deactivateAudioSession()
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
deactivateAudioSession() => Promise<void>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Deactivates the audio session (iOS only).
|
|
279
|
+
|
|
280
|
+
**Since:** 1.0.0
|
|
281
|
+
|
|
282
|
+
--------------------
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
### getPluginVersion()
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
getPluginVersion() => Promise<{ version: string; }>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Gets the native plugin version.
|
|
292
|
+
|
|
293
|
+
**Returns:** <code>Promise<{ version: string; }></code>
|
|
294
|
+
|
|
295
|
+
**Since:** 1.0.0
|
|
296
|
+
|
|
297
|
+
--------------------
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
### addListener('start', ...)
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
addListener(eventName: 'start', listenerFunc: (event: UtteranceEvent) => void) => Promise<PluginListenerHandle>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Listens for when an utterance starts speaking.
|
|
307
|
+
|
|
308
|
+
| Param | Type | Description |
|
|
309
|
+
| ------------------ | ----------------------------------------------------------------------------- | -------------------------- |
|
|
310
|
+
| **`eventName`** | <code>'start'</code> | - The event name ('start') |
|
|
311
|
+
| **`listenerFunc`** | <code>(event: <a href="#utteranceevent">UtteranceEvent</a>) => void</code> | - The callback function |
|
|
312
|
+
|
|
313
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
314
|
+
|
|
315
|
+
**Since:** 1.0.0
|
|
316
|
+
|
|
317
|
+
--------------------
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
### addListener('end', ...)
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
addListener(eventName: 'end', listenerFunc: (event: UtteranceEvent) => void) => Promise<PluginListenerHandle>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Listens for when an utterance finishes speaking.
|
|
327
|
+
|
|
328
|
+
| Param | Type | Description |
|
|
329
|
+
| ------------------ | ----------------------------------------------------------------------------- | ------------------------ |
|
|
330
|
+
| **`eventName`** | <code>'end'</code> | - The event name ('end') |
|
|
331
|
+
| **`listenerFunc`** | <code>(event: <a href="#utteranceevent">UtteranceEvent</a>) => void</code> | - The callback function |
|
|
332
|
+
|
|
333
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
334
|
+
|
|
335
|
+
**Since:** 1.0.0
|
|
336
|
+
|
|
337
|
+
--------------------
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
### addListener('boundary', ...)
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
addListener(eventName: 'boundary', listenerFunc: (event: BoundaryEvent) => void) => Promise<PluginListenerHandle>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Listens for word boundaries during speech.
|
|
347
|
+
|
|
348
|
+
| Param | Type | Description |
|
|
349
|
+
| ------------------ | --------------------------------------------------------------------------- | ----------------------------- |
|
|
350
|
+
| **`eventName`** | <code>'boundary'</code> | - The event name ('boundary') |
|
|
351
|
+
| **`listenerFunc`** | <code>(event: <a href="#boundaryevent">BoundaryEvent</a>) => void</code> | - The callback function |
|
|
352
|
+
|
|
353
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
354
|
+
|
|
355
|
+
**Since:** 1.0.0
|
|
356
|
+
|
|
357
|
+
--------------------
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
### addListener('error', ...)
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
addListener(eventName: 'error', listenerFunc: (event: ErrorEvent) => void) => Promise<PluginListenerHandle>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Listens for synthesis errors.
|
|
367
|
+
|
|
368
|
+
| Param | Type | Description |
|
|
369
|
+
| ------------------ | --------------------------------------------------------------------- | -------------------------- |
|
|
370
|
+
| **`eventName`** | <code>'error'</code> | - The event name ('error') |
|
|
371
|
+
| **`listenerFunc`** | <code>(event: <a href="#errorevent">ErrorEvent</a>) => void</code> | - The callback function |
|
|
372
|
+
|
|
373
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
374
|
+
|
|
375
|
+
**Since:** 1.0.0
|
|
376
|
+
|
|
377
|
+
--------------------
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
### removeAllListeners()
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
removeAllListeners() => Promise<void>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Removes all event listeners.
|
|
387
|
+
|
|
388
|
+
**Since:** 1.0.0
|
|
389
|
+
|
|
390
|
+
--------------------
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
### Interfaces
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
#### SpeakResult
|
|
397
|
+
|
|
398
|
+
Result from speaking text.
|
|
399
|
+
|
|
400
|
+
| Prop | Type | Description | Since |
|
|
401
|
+
| ----------------- | ------------------- | ------------------------------------- | ----- |
|
|
402
|
+
| **`utteranceId`** | <code>string</code> | Unique identifier for this utterance. | 1.0.0 |
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
#### SpeakOptions
|
|
406
|
+
|
|
407
|
+
Options for speaking text.
|
|
408
|
+
|
|
409
|
+
| Prop | Type | Description | Since |
|
|
410
|
+
| ------------------- | ----------------------------- | ------------------------------------------------------------------------------- | ----- |
|
|
411
|
+
| **`text`** | <code>string</code> | The text to speak. | 1.0.0 |
|
|
412
|
+
| **`language`** | <code>string</code> | The BCP-47 language tag (e.g., 'en-US', 'es-ES'). | 1.0.0 |
|
|
413
|
+
| **`voiceId`** | <code>string</code> | The voice identifier to use. | 1.0.0 |
|
|
414
|
+
| **`pitch`** | <code>number</code> | The pitch of the voice (0.5 to 2.0, default: 1.0). | 1.0.0 |
|
|
415
|
+
| **`rate`** | <code>number</code> | The speaking rate (0.1 to 10.0, default: 1.0). | 1.0.0 |
|
|
416
|
+
| **`volume`** | <code>number</code> | The volume (0.0 to 1.0, default: 1.0). | 1.0.0 |
|
|
417
|
+
| **`queueStrategy`** | <code>'Add' \| 'Flush'</code> | The queue strategy: 'Add' to append or 'Flush' to replace queue. Default: 'Add' | 1.0.0 |
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
#### SynthesizeToFileResult
|
|
421
|
+
|
|
422
|
+
Result from synthesizing to file.
|
|
423
|
+
|
|
424
|
+
| Prop | Type | Description | Since |
|
|
425
|
+
| ----------------- | ------------------- | ------------------------------------- | ----- |
|
|
426
|
+
| **`filePath`** | <code>string</code> | The file path where audio was saved. | 1.0.0 |
|
|
427
|
+
| **`utteranceId`** | <code>string</code> | Unique identifier for this utterance. | 1.0.0 |
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
#### VoiceInfo
|
|
431
|
+
|
|
432
|
+
Information about a voice.
|
|
433
|
+
|
|
434
|
+
| Prop | Type | Description | Since |
|
|
435
|
+
| --------------------------------- | -------------------------------------------- | ------------------------------------------------- | ----- |
|
|
436
|
+
| **`id`** | <code>string</code> | Unique voice identifier. | 1.0.0 |
|
|
437
|
+
| **`name`** | <code>string</code> | Display name of the voice. | 1.0.0 |
|
|
438
|
+
| **`language`** | <code>string</code> | BCP-47 language code. | 1.0.0 |
|
|
439
|
+
| **`gender`** | <code>'male' \| 'female' \| 'neutral'</code> | Gender of the voice (iOS only). | 1.0.0 |
|
|
440
|
+
| **`isNetworkConnectionRequired`** | <code>boolean</code> | Whether this voice requires a network connection. | 1.0.0 |
|
|
441
|
+
| **`default`** | <code>boolean</code> | Whether this is the default voice (Web only). | 1.0.0 |
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
#### IsLanguageAvailableOptions
|
|
445
|
+
|
|
446
|
+
Options for checking language availability.
|
|
447
|
+
|
|
448
|
+
| Prop | Type | Description | Since |
|
|
449
|
+
| -------------- | ------------------- | ---------------------------------- | ----- |
|
|
450
|
+
| **`language`** | <code>string</code> | The BCP-47 language code to check. | 1.0.0 |
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
#### IsVoiceAvailableOptions
|
|
454
|
+
|
|
455
|
+
Options for checking voice availability.
|
|
456
|
+
|
|
457
|
+
| Prop | Type | Description | Since |
|
|
458
|
+
| ------------- | ------------------- | ---------------------- | ----- |
|
|
459
|
+
| **`voiceId`** | <code>string</code> | The voice ID to check. | 1.0.0 |
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
#### ActivateAudioSessionOptions
|
|
463
|
+
|
|
464
|
+
Options for activating the audio session (iOS only).
|
|
465
|
+
|
|
466
|
+
| Prop | Type | Description | Since |
|
|
467
|
+
| -------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------- | ----- |
|
|
468
|
+
| **`category`** | <code>'Ambient' \| 'Playback'</code> | The audio session category. - 'Ambient': Mixes with other audio - 'Playback': Stops other audio | 1.0.0 |
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
#### PluginListenerHandle
|
|
472
|
+
|
|
473
|
+
| Prop | Type |
|
|
474
|
+
| ------------ | ----------------------------------------- |
|
|
475
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
#### UtteranceEvent
|
|
479
|
+
|
|
480
|
+
Event emitted when utterance starts or ends.
|
|
481
|
+
|
|
482
|
+
| Prop | Type | Description | Since |
|
|
483
|
+
| ----------------- | ------------------- | ------------------------- | ----- |
|
|
484
|
+
| **`utteranceId`** | <code>string</code> | The utterance identifier. | 1.0.0 |
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
#### BoundaryEvent
|
|
488
|
+
|
|
489
|
+
Event emitted at word boundaries.
|
|
490
|
+
|
|
491
|
+
| Prop | Type | Description | Since |
|
|
492
|
+
| ----------------- | ------------------- | ----------------------------------------- | ----- |
|
|
493
|
+
| **`utteranceId`** | <code>string</code> | The utterance identifier. | 1.0.0 |
|
|
494
|
+
| **`charIndex`** | <code>number</code> | The character index in the text. | 1.0.0 |
|
|
495
|
+
| **`charLength`** | <code>number</code> | The character length of the current word. | 1.0.0 |
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
#### ErrorEvent
|
|
499
|
+
|
|
500
|
+
Event emitted on synthesis error.
|
|
501
|
+
|
|
502
|
+
| Prop | Type | Description | Since |
|
|
503
|
+
| ----------------- | ------------------- | ------------------------- | ----- |
|
|
504
|
+
| **`utteranceId`** | <code>string</code> | The utterance identifier. | 1.0.0 |
|
|
505
|
+
| **`error`** | <code>string</code> | The error message. | 1.0.0 |
|
|
506
|
+
|
|
507
|
+
</docgen-api>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "ee.forgr.plugin.speechsynthesis"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
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
|
+
}
|