@capacitor-community/text-to-speech 0.2.3 → 1.1.2

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.
Files changed (36) hide show
  1. package/CapacitorCommunityTextToSpeech.podspec +1 -1
  2. package/LICENSE +1 -1
  3. package/README.md +169 -113
  4. package/android/build.gradle +14 -8
  5. package/android/src/main/AndroidManifest.xml +3 -5
  6. package/android/src/main/java/com/getcapacitor/community/tts/SpeakResultCallback.java +6 -0
  7. package/android/src/main/java/com/getcapacitor/community/tts/TextToSpeech.java +98 -180
  8. package/android/src/main/java/com/getcapacitor/community/tts/TextToSpeechPlugin.java +130 -0
  9. package/android/src/main/res/.gitkeep +0 -0
  10. package/dist/docs.json +194 -0
  11. package/dist/esm/definitions.d.ts +70 -17
  12. package/dist/esm/definitions.js +1 -0
  13. package/dist/esm/definitions.js.map +1 -1
  14. package/dist/esm/index.d.ts +3 -1
  15. package/dist/esm/index.js +9 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/web.d.ts +7 -9
  18. package/dist/esm/web.js +48 -76
  19. package/dist/esm/web.js.map +1 -1
  20. package/dist/plugin.cjs.js +57 -75
  21. package/dist/plugin.cjs.js.map +1 -1
  22. package/dist/plugin.js +59 -75
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Plugin/Info.plist +1 -1
  25. package/ios/Plugin/TextToSpeech.swift +81 -0
  26. package/ios/Plugin/{Plugin.h → TextToSpeechPlugin.h} +0 -0
  27. package/ios/Plugin/{Plugin.m → TextToSpeechPlugin.m} +2 -3
  28. package/ios/Plugin/TextToSpeechPlugin.swift +64 -0
  29. package/package.json +36 -21
  30. package/CHANGELOG.md +0 -46
  31. package/android/src/main/java/com/getcapacitor/community/tts/Constant.java +0 -8
  32. package/android/src/main/res/layout/bridge_layout_main.xml +0 -15
  33. package/android/src/main/res/values/colors.xml +0 -3
  34. package/android/src/main/res/values/strings.xml +0 -3
  35. package/android/src/main/res/values/styles.xml +0 -3
  36. package/ios/Plugin/Plugin.swift +0 -119
@@ -1,9 +1,5 @@
1
1
  package com.getcapacitor.community.tts;
2
2
 
3
- import static com.getcapacitor.community.tts.Constant.ERROR_TTS_NOT_INITIALIZED;
4
- import static com.getcapacitor.community.tts.Constant.ERROR_UNSUPPORTED_LOCALE;
5
- import static com.getcapacitor.community.tts.Constant.ERROR_UTTERANCE;
6
-
7
3
  import android.content.Context;
8
4
  import android.content.Intent;
9
5
  import android.content.pm.PackageManager;
@@ -15,220 +11,142 @@ import android.speech.tts.Voice;
15
11
  import android.util.Log;
16
12
  import com.getcapacitor.JSArray;
17
13
  import com.getcapacitor.JSObject;
18
- import com.getcapacitor.NativePlugin;
19
- import com.getcapacitor.Plugin;
20
- import com.getcapacitor.PluginCall;
21
- import com.getcapacitor.PluginMethod;
22
14
  import java.util.ArrayList;
23
15
  import java.util.HashMap;
24
16
  import java.util.Locale;
25
17
  import java.util.Set;
26
18
 
27
- @NativePlugin
28
- public class TextToSpeech extends Plugin implements android.speech.tts.TextToSpeech.OnInitListener {
19
+ public class TextToSpeech implements android.speech.tts.TextToSpeech.OnInitListener {
29
20
 
30
- public static final String TAG = "TextToSpeech";
21
+ public static final String LOG_TAG = "TextToSpeech";
31
22
 
32
- private boolean ttsInitialized = false;
23
+ private Context context;
33
24
  private android.speech.tts.TextToSpeech tts = null;
34
- private Context context = null;
35
- private ArrayList<Locale> supportedLocales = new ArrayList<>();
25
+ private int initializationStatus;
26
+ private JSObject[] supportedVoices = null;
36
27
 
37
- @Override
38
- public void onInit(int status) {
28
+ TextToSpeech(Context context) {
29
+ this.context = context;
39
30
  try {
40
- if (status != android.speech.tts.TextToSpeech.SUCCESS) {
41
- tts = null;
42
- ttsInitialized = false;
43
- } else {
44
- if (Build.VERSION.SDK_INT >= 21) {
45
- Bundle ttsParams = new Bundle();
46
- ttsParams.putSerializable(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "");
47
- tts.setLanguage(new Locale("en", "US"));
48
- tts.speak("", android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams, "");
49
- } else {
50
- HashMap<String, String> ttsParams = new HashMap<>();
51
- ttsParams.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "");
52
- tts.setLanguage(new Locale("en", "US"));
53
- tts.speak("", android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams);
54
- }
55
- Set<Locale> availableLanguages = tts.getAvailableLanguages();
56
- if (availableLanguages != null) {
57
- this.supportedLocales.addAll(availableLanguages);
58
- }
59
- ttsInitialized = true;
60
- }
31
+ tts = new android.speech.tts.TextToSpeech(context, this);
61
32
  } catch (Exception ex) {
62
- Log.d(TAG, "Caught exception while listening to OnInitListener.OnInit(): " + ex.getLocalizedMessage());
63
-
64
- ttsInitialized = false;
33
+ Log.d(LOG_TAG, ex.getLocalizedMessage());
65
34
  }
66
35
  }
67
36
 
68
37
  @Override
69
- public void load() {
70
- super.load();
71
-
72
- try {
73
- context = getContext();
74
- tts = new android.speech.tts.TextToSpeech(context, this);
75
- } catch (Exception ex) {
76
- Log.d(TAG, "Caught exception on TextToSpeech load(): " + ex.getLocalizedMessage());
77
- }
38
+ public void onInit(int status) {
39
+ this.initializationStatus = status;
78
40
  }
79
41
 
80
- @PluginMethod
81
- public void speak(final PluginCall call) {
82
- try {
83
- String text = call.getString("text", "");
84
- String locale = call.getString("locale", "en-US");
85
- float speechRate = call.getFloat("speechRate", 1.0f);
86
- float pitchRate = call.getFloat("pitchRate", 1.0f);
87
- double volume = call.getDouble("volume", 1.0);
88
-
89
- if (!supportedLocales.contains(Locale.forLanguageTag((locale)))) {
90
- call.error(ERROR_UNSUPPORTED_LOCALE);
91
- return;
92
- }
93
-
94
- if (tts == null || !ttsInitialized) {
95
- call.error(ERROR_TTS_NOT_INITIALIZED);
96
- return;
97
- }
42
+ public void speak(
43
+ String text,
44
+ String lang,
45
+ float rate,
46
+ float pitch,
47
+ float volume,
48
+ String callbackId,
49
+ SpeakResultCallback resultCallback
50
+ ) {
51
+ tts.stop();
52
+ tts.setOnUtteranceProgressListener(
53
+ new UtteranceProgressListener() {
54
+ @Override
55
+ public void onStart(String utteranceId) {}
56
+
57
+ @Override
58
+ public void onDone(String utteranceId) {
59
+ resultCallback.onDone();
60
+ }
98
61
 
99
- tts.stop();
100
-
101
- tts.setOnUtteranceProgressListener(
102
- new UtteranceProgressListener() {
103
- @Override
104
- public void onStart(String utteranceId) {}
105
-
106
- @Override
107
- public void onDone(String utteranceId) {
108
- if (!utteranceId.equals("")) {
109
- call.success();
110
- }
111
- }
112
-
113
- @Override
114
- public void onError(String utteranceId) {
115
- if (!utteranceId.equals("")) {
116
- call.error(ERROR_UTTERANCE);
117
- }
118
- }
62
+ @Override
63
+ public void onError(String utteranceId) {
64
+ resultCallback.onError();
119
65
  }
120
- );
121
-
122
- if (Build.VERSION.SDK_INT >= 21) {
123
- Bundle ttsParams = new Bundle();
124
- ttsParams.putSerializable(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, call.getCallbackId());
125
- ttsParams.putSerializable(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_VOLUME, volume);
126
-
127
- tts.setLanguage(new Locale(locale));
128
- tts.setSpeechRate(speechRate);
129
- tts.setPitch(pitchRate);
130
- tts.speak(text, android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams, call.getCallbackId());
131
- } else {
132
- HashMap<String, String> ttsParams = new HashMap<>();
133
- ttsParams.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, call.getCallbackId());
134
- ttsParams.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_VOLUME, Double.toString(volume));
135
-
136
- tts.setLanguage(new Locale(locale));
137
- tts.setPitch(pitchRate);
138
- tts.speak(text, android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams);
139
66
  }
140
- } catch (Exception ex) {
141
- Log.d(TAG, "Exception caught while handling speak(): " + ex.getLocalizedMessage());
142
- call.error(ex.getLocalizedMessage());
143
- }
144
- }
67
+ );
145
68
 
146
- @PluginMethod
147
- public void stop(PluginCall call) {
148
- try {
149
- tts.stop();
150
- call.success();
151
- } catch (Exception ex) {
152
- Log.d(TAG, "Exception caught while handling stop(): " + ex.getLocalizedMessage());
153
- call.error(ex.getLocalizedMessage());
154
- }
155
- }
69
+ Locale locale = Locale.forLanguageTag(lang);
156
70
 
157
- @PluginMethod
158
- public void getSupportedLanguages(PluginCall call) {
159
- try {
160
- ArrayList<String> languages = new ArrayList<>();
161
- for (Locale supportedLocale : this.supportedLocales) {
162
- String tag = supportedLocale.toLanguageTag();
163
- languages.add(tag);
164
- }
165
- JSObject ret = new JSObject();
166
- ret.put("languages", JSArray.from(languages.toArray()));
167
- call.success(ret);
168
- } catch (Exception ex) {
169
- Log.d(TAG, "Exception caught while handling checkLanguage(): " + ex.getLocalizedMessage());
170
- call.error(ex.getLocalizedMessage());
71
+ if (Build.VERSION.SDK_INT >= 21) {
72
+ Bundle ttsParams = new Bundle();
73
+ ttsParams.putSerializable(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId);
74
+ ttsParams.putSerializable(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_VOLUME, volume);
75
+
76
+ tts.setLanguage(locale);
77
+ tts.setSpeechRate(rate);
78
+ tts.setPitch(pitch);
79
+ tts.speak(text, android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams, callbackId);
80
+ } else {
81
+ HashMap<String, String> ttsParams = new HashMap<>();
82
+ ttsParams.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId);
83
+ ttsParams.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_VOLUME, Float.toString(volume));
84
+
85
+ tts.setLanguage(locale);
86
+ tts.setSpeechRate(rate);
87
+ tts.setPitch(pitch);
88
+ tts.speak(text, android.speech.tts.TextToSpeech.QUEUE_FLUSH, ttsParams);
171
89
  }
172
90
  }
173
91
 
174
- @PluginMethod
175
- public void setPitchRate(final PluginCall call) {
176
- float pitchRate = call.getFloat("pitchRate", 1.0f);
177
- tts.setPitch(pitchRate);
178
-
179
- call.success();
92
+ public void stop() {
93
+ tts.stop();
180
94
  }
181
95
 
182
- @PluginMethod
183
- public void setSpeechRate(final PluginCall call) {
184
- float speechRate = call.getFloat("speechRate", 1.0f);
185
-
186
- if (Build.VERSION.SDK_INT >= 27) {
187
- tts.setSpeechRate((float) speechRate * 0.7f);
188
- } else {
189
- tts.setSpeechRate((float) speechRate);
96
+ public JSArray getSupportedLanguages() {
97
+ ArrayList<String> languages = new ArrayList<>();
98
+ Set<Locale> supportedLocales = tts.getAvailableLanguages();
99
+ for (Locale supportedLocale : supportedLocales) {
100
+ String tag = supportedLocale.toLanguageTag();
101
+ languages.add(tag);
190
102
  }
191
-
192
- call.success();
103
+ JSArray result = JSArray.from(languages.toArray());
104
+ return result;
193
105
  }
194
106
 
195
- @PluginMethod
196
- public void openInstall(PluginCall call) {
197
- try {
198
- PackageManager packageManager = context.getPackageManager();
199
- Intent installIntent = new Intent();
200
- installIntent.setAction(android.speech.tts.TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
107
+ public JSArray getSupportedVoices() {
108
+ ArrayList<JSObject> voices = new ArrayList<>();
109
+ Set<Voice> supportedVoices = tts.getVoices();
110
+ for (Voice supportedVoice : supportedVoices) {
111
+ JSObject obj = this.convertVoiceToJSObject(supportedVoice);
112
+ voices.add(obj);
113
+ }
114
+ JSArray result = JSArray.from(voices.toArray());
115
+ return result;
116
+ }
201
117
 
202
- ResolveInfo resolveInfo = packageManager.resolveActivity(installIntent, PackageManager.MATCH_DEFAULT_ONLY);
118
+ public void openInstall() {
119
+ PackageManager packageManager = context.getPackageManager();
120
+ Intent installIntent = new Intent();
121
+ installIntent.setAction(android.speech.tts.TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
203
122
 
204
- if (resolveInfo == null) {} else {
205
- installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
206
- context.startActivity(installIntent);
207
- }
123
+ ResolveInfo resolveInfo = packageManager.resolveActivity(installIntent, PackageManager.MATCH_DEFAULT_ONLY);
208
124
 
209
- call.success();
210
- } catch (Exception ex) {
211
- Log.d(TAG, "Caught exception while handling openInstall(): " + ex.getLocalizedMessage());
125
+ if (resolveInfo != null) {
126
+ installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
127
+ context.startActivity(installIntent);
128
+ }
129
+ }
212
130
 
213
- call.error(ex.getLocalizedMessage());
131
+ public boolean isAvailable() {
132
+ if (tts != null && initializationStatus == android.speech.tts.TextToSpeech.SUCCESS) {
133
+ return true;
214
134
  }
135
+ return false;
215
136
  }
216
137
 
217
- @PluginMethod
218
- public void getSupportedVoices(PluginCall call) {
219
- try {
220
- ArrayList<JSObject> voices = new ArrayList<>();
221
- Set<Voice> supportedVoices = tts.getVoices();
222
- for (Voice supportedVoice : supportedVoices) {
223
- JSObject obj = this.convertVoiceToJSObject(supportedVoice);
224
- voices.add(obj);
225
- }
226
- JSObject ret = new JSObject();
227
- ret.put("voices", JSArray.from(voices.toArray()));
228
- call.success(ret);
229
- } catch (Exception ex) {
230
- call.error(ex.getLocalizedMessage());
138
+ public boolean isLanguageSupported(String lang) {
139
+ Locale locale = Locale.forLanguageTag(lang);
140
+ int result = tts.isLanguageAvailable(locale);
141
+ return result == tts.LANG_AVAILABLE || result == tts.LANG_COUNTRY_AVAILABLE || result == tts.LANG_COUNTRY_VAR_AVAILABLE;
142
+ }
143
+
144
+ public void onDestroy() {
145
+ if (tts == null) {
146
+ return;
231
147
  }
148
+ tts.stop();
149
+ tts.shutdown();
232
150
  }
233
151
 
234
152
  private JSObject convertVoiceToJSObject(Voice voice) {
@@ -0,0 +1,130 @@
1
+ package com.getcapacitor.community.tts;
2
+
3
+ import com.getcapacitor.JSArray;
4
+ import com.getcapacitor.JSObject;
5
+ import com.getcapacitor.Plugin;
6
+ import com.getcapacitor.PluginCall;
7
+ import com.getcapacitor.PluginMethod;
8
+ import com.getcapacitor.annotation.CapacitorPlugin;
9
+
10
+ @CapacitorPlugin(name = "TextToSpeech")
11
+ public class TextToSpeechPlugin extends Plugin {
12
+
13
+ public static final String LOG_TAG = "TextToSpeechPlugin";
14
+
15
+ public static final String ERROR_UTTERANCE = "Failed to read text.";
16
+ public static final String ERROR_UNSUPPORTED_LANGUAGE = "This language is not supported.";
17
+
18
+ private TextToSpeech implementation;
19
+
20
+ @Override
21
+ public void load() {
22
+ implementation = new TextToSpeech(getContext());
23
+ }
24
+
25
+ @PluginMethod
26
+ public void speak(PluginCall call) {
27
+ boolean isAvailable = implementation.isAvailable();
28
+ if (!isAvailable) {
29
+ call.unavailable("Not yet initialized or not available on this device.");
30
+ return;
31
+ }
32
+
33
+ String text = call.getString("text", "");
34
+ String lang = call.getString("lang", "en-US");
35
+ float rate = call.getFloat("rate", 1.0f);
36
+ float pitch = call.getFloat("pitch", 1.0f);
37
+ float volume = call.getFloat("volume", 1.0f);
38
+
39
+ boolean isLanguageSupported = implementation.isLanguageSupported(lang);
40
+ if (!isLanguageSupported) {
41
+ call.reject(ERROR_UNSUPPORTED_LANGUAGE);
42
+ return;
43
+ }
44
+
45
+ SpeakResultCallback resultCallback = new SpeakResultCallback() {
46
+ @Override
47
+ public void onDone() {
48
+ call.resolve();
49
+ }
50
+
51
+ @Override
52
+ public void onError() {
53
+ call.reject(ERROR_UTTERANCE);
54
+ }
55
+ };
56
+
57
+ try {
58
+ implementation.speak(text, lang, rate, pitch, volume, call.getCallbackId(), resultCallback);
59
+ } catch (Exception ex) {
60
+ call.reject(ex.getLocalizedMessage());
61
+ }
62
+ }
63
+
64
+ @PluginMethod
65
+ public void stop(PluginCall call) {
66
+ boolean isAvailable = implementation.isAvailable();
67
+ if (!isAvailable) {
68
+ call.unavailable("Not yet initialized or not available on this device.");
69
+ return;
70
+ }
71
+ try {
72
+ implementation.stop();
73
+ call.resolve();
74
+ } catch (Exception ex) {
75
+ call.reject(ex.getLocalizedMessage());
76
+ }
77
+ }
78
+
79
+ @PluginMethod
80
+ public void getSupportedLanguages(PluginCall call) {
81
+ try {
82
+ JSArray languages = implementation.getSupportedLanguages();
83
+ JSObject ret = new JSObject();
84
+ ret.put("languages", languages);
85
+ call.resolve(ret);
86
+ } catch (Exception ex) {
87
+ call.reject(ex.getLocalizedMessage());
88
+ }
89
+ }
90
+
91
+ @PluginMethod
92
+ public void getSupportedVoices(PluginCall call) {
93
+ try {
94
+ JSArray voices = implementation.getSupportedVoices();
95
+ JSObject ret = new JSObject();
96
+ ret.put("voices", voices);
97
+ call.resolve(ret);
98
+ } catch (Exception ex) {
99
+ call.reject(ex.getLocalizedMessage());
100
+ }
101
+ }
102
+
103
+ @PluginMethod
104
+ public void isLanguageSupported(PluginCall call) {
105
+ String lang = call.getString("lang", "");
106
+ try {
107
+ boolean isLanguageSupported = implementation.isLanguageSupported(lang);
108
+ JSObject ret = new JSObject();
109
+ ret.put("supported", isLanguageSupported);
110
+ call.resolve(ret);
111
+ } catch (Exception ex) {
112
+ call.reject(ex.getLocalizedMessage());
113
+ }
114
+ }
115
+
116
+ @PluginMethod
117
+ public void openInstall(PluginCall call) {
118
+ try {
119
+ implementation.openInstall();
120
+ call.resolve();
121
+ } catch (Exception ex) {
122
+ call.reject(ex.getLocalizedMessage());
123
+ }
124
+ }
125
+
126
+ @Override
127
+ protected void handleOnDestroy() {
128
+ implementation.onDestroy();
129
+ }
130
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,194 @@
1
+ {
2
+ "api": {
3
+ "name": "TextToSpeechPlugin",
4
+ "slug": "texttospeechplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "speak",
10
+ "signature": "(options: TTSOptions) => Promise<void>",
11
+ "parameters": [
12
+ {
13
+ "name": "options",
14
+ "docs": "",
15
+ "type": "TTSOptions"
16
+ }
17
+ ],
18
+ "returns": "Promise<void>",
19
+ "tags": [],
20
+ "docs": "Starts the TTS engine and plays the desired text.",
21
+ "complexTypes": [
22
+ "TTSOptions"
23
+ ],
24
+ "slug": "speak"
25
+ },
26
+ {
27
+ "name": "stop",
28
+ "signature": "() => Promise<void>",
29
+ "parameters": [],
30
+ "returns": "Promise<void>",
31
+ "tags": [],
32
+ "docs": "Stops the TTS engine.",
33
+ "complexTypes": [],
34
+ "slug": "stop"
35
+ },
36
+ {
37
+ "name": "getSupportedLanguages",
38
+ "signature": "() => Promise<{ languages: string[]; }>",
39
+ "parameters": [],
40
+ "returns": "Promise<{ languages: string[]; }>",
41
+ "tags": [],
42
+ "docs": "Returns a list of supported BCP 47 language tags.",
43
+ "complexTypes": [],
44
+ "slug": "getsupportedlanguages"
45
+ },
46
+ {
47
+ "name": "getSupportedVoices",
48
+ "signature": "() => Promise<{ voices: SpeechSynthesisVoice[]; }>",
49
+ "parameters": [],
50
+ "returns": "Promise<{ voices: SpeechSynthesisVoice[]; }>",
51
+ "tags": [],
52
+ "docs": "Returns a list of supported voices.",
53
+ "complexTypes": [
54
+ "SpeechSynthesisVoice"
55
+ ],
56
+ "slug": "getsupportedvoices"
57
+ },
58
+ {
59
+ "name": "isLanguageSupported",
60
+ "signature": "(options: { lang: string; }) => Promise<{ supported: boolean; }>",
61
+ "parameters": [
62
+ {
63
+ "name": "options",
64
+ "docs": "",
65
+ "type": "{ lang: string; }"
66
+ }
67
+ ],
68
+ "returns": "Promise<{ supported: boolean; }>",
69
+ "tags": [],
70
+ "docs": "Checks if a specific BCP 47 language tag is supported.",
71
+ "complexTypes": [],
72
+ "slug": "islanguagesupported"
73
+ },
74
+ {
75
+ "name": "openInstall",
76
+ "signature": "() => Promise<void>",
77
+ "parameters": [],
78
+ "returns": "Promise<void>",
79
+ "tags": [],
80
+ "docs": "Verifies proper installation and availability of resource files on the system.\n\nOnly available for Android.",
81
+ "complexTypes": [],
82
+ "slug": "openinstall"
83
+ }
84
+ ],
85
+ "properties": []
86
+ },
87
+ "interfaces": [
88
+ {
89
+ "name": "TTSOptions",
90
+ "slug": "ttsoptions",
91
+ "docs": "",
92
+ "tags": [],
93
+ "methods": [],
94
+ "properties": [
95
+ {
96
+ "name": "text",
97
+ "tags": [],
98
+ "docs": "The text that will be synthesised when the utterance is spoken.",
99
+ "complexTypes": [],
100
+ "type": "string"
101
+ },
102
+ {
103
+ "name": "lang",
104
+ "tags": [],
105
+ "docs": "The language of the utterance.\nPossible languages can be queried using `getSupportedLanguages`.\n\nDefault: `en-US`.",
106
+ "complexTypes": [],
107
+ "type": "string | undefined"
108
+ },
109
+ {
110
+ "name": "rate",
111
+ "tags": [],
112
+ "docs": "The speed at which the utterance will be spoken at.\n\nDefault: `1.0`.",
113
+ "complexTypes": [],
114
+ "type": "number | undefined"
115
+ },
116
+ {
117
+ "name": "pitch",
118
+ "tags": [],
119
+ "docs": "The pitch at which the utterance will be spoken at.\n\nDefault: `1.0`.",
120
+ "complexTypes": [],
121
+ "type": "number | undefined"
122
+ },
123
+ {
124
+ "name": "volume",
125
+ "tags": [],
126
+ "docs": "The volume that the utterance will be spoken at.\n\nDefault: `1.0`.",
127
+ "complexTypes": [],
128
+ "type": "number | undefined"
129
+ },
130
+ {
131
+ "name": "voice",
132
+ "tags": [],
133
+ "docs": "The index of the selected voice that will be used to speak the utterance.\nPossible voices can be queried using `getSupportedVoices`.\n\nOnly available for Web.",
134
+ "complexTypes": [],
135
+ "type": "number | undefined"
136
+ },
137
+ {
138
+ "name": "category",
139
+ "tags": [],
140
+ "docs": "Select the iOS Audio session category.\nPossible values: `ambient` and `playback`.\nUse `playback` to play audio even when the app is in the background.\n\nOnly available for iOS.\n\nDefault: `ambient`.",
141
+ "complexTypes": [],
142
+ "type": "string | undefined"
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ "name": "SpeechSynthesisVoice",
148
+ "slug": "speechsynthesisvoice",
149
+ "docs": "The SpeechSynthesisVoice interface represents a voice that the system supports.",
150
+ "tags": [],
151
+ "methods": [],
152
+ "properties": [
153
+ {
154
+ "name": "default",
155
+ "tags": [],
156
+ "docs": "Specifies whether the voice is the default voice for the current app (`true`) or not (`false`).",
157
+ "complexTypes": [],
158
+ "type": "boolean"
159
+ },
160
+ {
161
+ "name": "lang",
162
+ "tags": [],
163
+ "docs": "BCP 47 language tag indicating the language of the voice.\nExample: `en-US`.",
164
+ "complexTypes": [],
165
+ "type": "string"
166
+ },
167
+ {
168
+ "name": "localService",
169
+ "tags": [],
170
+ "docs": "Specifies whether the voice is supplied by a local (`true`) or remote (`false`) speech synthesizer service.",
171
+ "complexTypes": [],
172
+ "type": "boolean"
173
+ },
174
+ {
175
+ "name": "name",
176
+ "tags": [],
177
+ "docs": "Human-readable name that represents the voice.\nExample: `Microsoft Zira Desktop - English (United States)`.",
178
+ "complexTypes": [],
179
+ "type": "string"
180
+ },
181
+ {
182
+ "name": "voiceURI",
183
+ "tags": [],
184
+ "docs": "Type of URI and location of the speech synthesis service for this voice.\nExample: `urn:moz-tts:sapi:Microsoft Zira Desktop - English (United States)?en-US`.",
185
+ "complexTypes": [],
186
+ "type": "string"
187
+ }
188
+ ]
189
+ }
190
+ ],
191
+ "enums": [],
192
+ "typeAliases": [],
193
+ "pluginConfigs": []
194
+ }