expo-speech 12.0.1 → 12.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 12.0.2 — 2024-05-09
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [Web] Fix crash on `listenerCount` accessor. ([#28721](https://github.com/expo/expo/pull/28721) by [@aleqsio](https://github.com/aleqsio))
|
|
18
|
+
|
|
13
19
|
## 12.0.1 — 2024-04-23
|
|
14
20
|
|
|
15
21
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '12.0.
|
|
4
|
+
version = '12.0.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,6 +14,6 @@ android {
|
|
|
14
14
|
namespace "expo.modules.speech"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 18
|
|
17
|
-
versionName "12.0.
|
|
17
|
+
versionName "12.0.2"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentSpeech.web.d.ts","sourceRoot":"","sources":["../src/Speech/ExponentSpeech.web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;;cAwBrD,MAAM,QAAQ,MAAM,WAAW,aAAa,GAAG,QAAQ,wBAAwB,CAAC;iBAiE7E,QAAQ,QAAQ,EAAE,CAAC;kBAYlB,QAAQ,OAAO,CAAC;YAGtB,QAAQ,IAAI,CAAC;aAGZ,QAAQ,IAAI,CAAC;cAGZ,QAAQ,IAAI,CAAC;;;AAvF/B,
|
|
1
|
+
{"version":3,"file":"ExponentSpeech.web.d.ts","sourceRoot":"","sources":["../src/Speech/ExponentSpeech.web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;;cAwBrD,MAAM,QAAQ,MAAM,WAAW,aAAa,GAAG,QAAQ,wBAAwB,CAAC;iBAiE7E,QAAQ,QAAQ,EAAE,CAAC;kBAYlB,QAAQ,OAAO,CAAC;YAGtB,QAAQ,IAAI,CAAC;aAGZ,QAAQ,IAAI,CAAC;cAGZ,QAAQ,IAAI,CAAC;;;AAvF/B,wBA2FG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeviceEventEmitter, CodedError } from 'expo-modules-core';
|
|
1
|
+
import { DeviceEventEmitter, CodedError, createWebModule } from 'expo-modules-core';
|
|
2
2
|
import { VoiceQuality } from './Speech.types';
|
|
3
3
|
//https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/text
|
|
4
4
|
const MAX_SPEECH_INPUT_LENGTH = 32767;
|
|
@@ -17,7 +17,7 @@ async function getVoices() {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
export default {
|
|
20
|
+
export default createWebModule({
|
|
21
21
|
async speak(id, text, options) {
|
|
22
22
|
if (text.length > MAX_SPEECH_INPUT_LENGTH) {
|
|
23
23
|
throw new CodedError('ERR_SPEECH_INPUT_LENGTH', 'Speech input text is too long! Limit of input length is: ' + MAX_SPEECH_INPUT_LENGTH);
|
|
@@ -94,5 +94,5 @@ export default {
|
|
|
94
94
|
return window.speechSynthesis.resume();
|
|
95
95
|
},
|
|
96
96
|
maxSpeechInputLength: MAX_SPEECH_INPUT_LENGTH,
|
|
97
|
-
};
|
|
97
|
+
});
|
|
98
98
|
//# sourceMappingURL=ExponentSpeech.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentSpeech.web.js","sourceRoot":"","sources":["../src/Speech/ExponentSpeech.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExponentSpeech.web.js","sourceRoot":"","sources":["../src/Speech/ExponentSpeech.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpF,OAAO,EAA2B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEvE,gFAAgF;AAChF,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAEtC,KAAK,UAAU,SAAS;IACtB,OAAO,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;QAElD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,OAAO,CAAC,MAAM,CAAC,CAAC;YAChB,OAAO;SACR;QAED,6EAA6E;QAC7E,mDAAmD;QACnD,MAAM,CAAC,eAAe,CAAC,eAAe,GAAG;YACvC,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;YAClD,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,eAAe,CAAC;IAC7B,KAAK,CAAC,KAAK,CAAC,EAAU,EAAE,IAAY,EAAE,OAAsB;QAC1D,IAAI,IAAI,CAAC,MAAM,GAAG,uBAAuB,EAAE;YACzC,MAAM,IAAI,UAAU,CAClB,yBAAyB,EACzB,2DAA2D,GAAG,uBAAuB,CACtF,CAAC;SACH;QAED,MAAM,OAAO,GAAG,IAAI,wBAAwB,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,CAAC,OAAO;YACxB,QAAQ,EAAE,KAAK,CAAC,IAAI;YACpB,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC,CAAC;IACN,CAAC;IACD,KAAK,CAAC,UAAU;QACd,OAAO,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC;IACzC,CAAC;IACD,KAAK,CAAC,IAAI;QACR,OAAO,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;IACzC,CAAC;IACD,KAAK,CAAC,KAAK;QACT,OAAO,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;IACD,KAAK,CAAC,MAAM;QACV,OAAO,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;IACzC,CAAC;IACD,oBAAoB,EAAE,uBAAuB;CAC9C,CAAC,CAAC","sourcesContent":["import { DeviceEventEmitter, CodedError, createWebModule } from 'expo-modules-core';\n\nimport { SpeechOptions, WebVoice, VoiceQuality } from './Speech.types';\n\n//https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/text\nconst MAX_SPEECH_INPUT_LENGTH = 32767;\n\nasync function getVoices(): Promise<SpeechSynthesisVoice[]> {\n return new Promise<SpeechSynthesisVoice[]>((resolve) => {\n const voices = window.speechSynthesis.getVoices();\n\n if (voices.length > 0) {\n resolve(voices);\n return;\n }\n\n // when a page loads it takes some amount of time to populate the voices list\n // see https://stackoverflow.com/a/52005323/4337317\n window.speechSynthesis.onvoiceschanged = function () {\n const voices = window.speechSynthesis.getVoices();\n resolve(voices);\n };\n });\n}\n\nexport default createWebModule({\n async speak(id: string, text: string, options: SpeechOptions): Promise<SpeechSynthesisUtterance> {\n if (text.length > MAX_SPEECH_INPUT_LENGTH) {\n throw new CodedError(\n 'ERR_SPEECH_INPUT_LENGTH',\n 'Speech input text is too long! Limit of input length is: ' + MAX_SPEECH_INPUT_LENGTH\n );\n }\n\n const message = new SpeechSynthesisUtterance();\n\n if (typeof options.rate === 'number') {\n message.rate = options.rate;\n }\n if (typeof options.pitch === 'number') {\n message.pitch = options.pitch;\n }\n if (typeof options.language === 'string') {\n message.lang = options.language;\n }\n if (typeof options.volume === 'number') {\n message.volume = options.volume;\n }\n if ('_voiceIndex' in options && options._voiceIndex != null) {\n const voices = await getVoices();\n message.voice = voices[Math.min(voices.length - 1, Math.max(0, options._voiceIndex))];\n }\n if (typeof options.voice === 'string') {\n const voices = await getVoices();\n message.voice =\n voices[\n Math.max(\n 0,\n voices.findIndex((voice) => voice.voiceURI === options.voice)\n )\n ];\n }\n if (typeof options.onResume === 'function') {\n message.onresume = options.onResume;\n }\n if (typeof options.onMark === 'function') {\n message.onmark = options.onMark;\n }\n if (typeof options.onBoundary === 'function') {\n message.onboundary = options.onBoundary;\n }\n\n message.onstart = (nativeEvent: SpeechSynthesisEvent) => {\n DeviceEventEmitter.emit('Exponent.speakingStarted', { id, nativeEvent });\n };\n message.onend = (nativeEvent: SpeechSynthesisEvent) => {\n DeviceEventEmitter.emit('Exponent.speakingDone', { id, nativeEvent });\n };\n message.onpause = (nativeEvent: SpeechSynthesisEvent) => {\n DeviceEventEmitter.emit('Exponent.speakingStopped', { id, nativeEvent });\n };\n message.onerror = (nativeEvent: SpeechSynthesisErrorEvent) => {\n DeviceEventEmitter.emit('Exponent.speakingError', { id, nativeEvent });\n };\n\n message.text = text;\n\n window.speechSynthesis.speak(message);\n\n return message;\n },\n async getVoices(): Promise<WebVoice[]> {\n const voices = await getVoices();\n return voices.map((voice) => ({\n identifier: voice.voiceURI,\n quality: VoiceQuality.Default,\n isDefault: voice.default,\n language: voice.lang,\n localService: voice.localService,\n name: voice.name,\n voiceURI: voice.voiceURI,\n }));\n },\n async isSpeaking(): Promise<boolean> {\n return window.speechSynthesis.speaking;\n },\n async stop(): Promise<void> {\n return window.speechSynthesis.cancel();\n },\n async pause(): Promise<void> {\n return window.speechSynthesis.pause();\n },\n async resume(): Promise<void> {\n return window.speechSynthesis.resume();\n },\n maxSpeechInputLength: MAX_SPEECH_INPUT_LENGTH,\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-speech",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2",
|
|
4
4
|
"description": "Provides text-to-speech functionality.",
|
|
5
5
|
"main": "build/Speech.js",
|
|
6
6
|
"types": "build/Speech.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"expo": "*"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9857711b8ec18ddecd36f9291ade5ccccbabddbc"
|
|
46
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeviceEventEmitter, CodedError } from 'expo-modules-core';
|
|
1
|
+
import { DeviceEventEmitter, CodedError, createWebModule } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
import { SpeechOptions, WebVoice, VoiceQuality } from './Speech.types';
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ async function getVoices(): Promise<SpeechSynthesisVoice[]> {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export default {
|
|
26
|
+
export default createWebModule({
|
|
27
27
|
async speak(id: string, text: string, options: SpeechOptions): Promise<SpeechSynthesisUtterance> {
|
|
28
28
|
if (text.length > MAX_SPEECH_INPUT_LENGTH) {
|
|
29
29
|
throw new CodedError(
|
|
@@ -114,4 +114,4 @@ export default {
|
|
|
114
114
|
return window.speechSynthesis.resume();
|
|
115
115
|
},
|
|
116
116
|
maxSpeechInputLength: MAX_SPEECH_INPUT_LENGTH,
|
|
117
|
-
};
|
|
117
|
+
});
|