@capacitor-community/text-to-speech 2.1.0 → 3.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.
@@ -1,8 +1,8 @@
1
1
  ext {
2
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'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,18 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:7.2.1'
14
+ classpath 'com.android.tools.build:gradle:8.0.0'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
21
+ namespace "com.getcapacitor.community.tts"
22
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
22
23
  defaultConfig {
23
24
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
25
26
  versionCode 1
26
27
  versionName "1.0"
27
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,8 +37,8 @@ android {
36
37
  abortOnError false
37
38
  }
38
39
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_11
40
- targetCompatibility JavaVersion.VERSION_11
40
+ sourceCompatibility JavaVersion.VERSION_17
41
+ targetCompatibility JavaVersion.VERSION_17
41
42
  }
42
43
  }
43
44
 
@@ -1,3 +1,2 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.getcapacitor.community.tts">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
  </manifest>
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface TextToSpeechPlugin {\n /**\n * Starts the TTS engine and plays the desired text.\n */\n speak(options: TTSOptions): Promise<void>;\n /**\n * Stops the TTS engine.\n */\n stop(): Promise<void>;\n /**\n * Returns a list of supported BCP 47 language tags.\n */\n getSupportedLanguages(): Promise<{ languages: string[] }>;\n /**\n * Returns a list of supported voices.\n */\n getSupportedVoices(): Promise<{ voices: SpeechSynthesisVoice[] }>;\n /**\n * Checks if a specific BCP 47 language tag is supported.\n */\n isLanguageSupported(options: {\n lang: string;\n }): Promise<{ supported: boolean }>;\n /**\n * Verifies proper installation and availability of resource files on the system.\n *\n * Only available for Android.\n */\n openInstall(): Promise<void>;\n}\n\nexport interface TTSOptions {\n /**\n * The text that will be synthesised when the utterance is spoken.\n * \n * @example \"Hello world\"\n */\n text: string;\n /**\n * The language of the utterance.\n * Possible languages can be queried using `getSupportedLanguages`.\n *\n * @default \"en-US\"\n */\n lang?: string;\n /**\n * The speed at which the utterance will be spoken at.\n *\n * @default 1.0\n */\n rate?: number;\n /**\n * The pitch at which the utterance will be spoken at.\n *\n * @default 1.0\n */\n pitch?: number;\n /**\n * The volume that the utterance will be spoken at.\n *\n * @default 1.0\n */\n volume?: number;\n /**\n * The index of the selected voice that will be used to speak the utterance.\n * Possible voices can be queried using `getSupportedVoices`.\n */\n voice?: number;\n /**\n * Select the iOS Audio session category.\n * Possible values: `ambient` and `playback`.\n * Use `playback` to play audio even when the app is in the background.\n *\n * Only available for iOS.\n *\n * @default \"ambient\"\n */\n category?: string;\n}\n\n/**\n * The SpeechSynthesisVoice interface represents a voice that the system supports.\n */\nexport interface SpeechSynthesisVoice {\n /**\n * Specifies whether the voice is the default voice for the current app (`true`) or not (`false`).\n * \n * @example false\n */\n default: boolean;\n /**\n * BCP 47 language tag indicating the language of the voice.\n * \n * @example \"en-US\"\n */\n lang: string;\n /**\n * Specifies whether the voice is supplied by a local (`true`) or remote (`false`) speech synthesizer service.\n * \n * @example true\n */\n localService: boolean;\n /**\n * Human-readable name that represents the voice.\n * \n * @example \"Microsoft Zira Desktop - English (United States)\"\n */\n name: string;\n /**\n * Type of URI and location of the speech synthesis service for this voice.\n * \n * @example \"urn:moz-tts:sapi:Microsoft Zira Desktop - English (United States)?en-US\"\n */\n voiceURI: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface TextToSpeechPlugin {\n /**\n * Starts the TTS engine and plays the desired text.\n */\n speak(options: TTSOptions): Promise<void>;\n /**\n * Stops the TTS engine.\n */\n stop(): Promise<void>;\n /**\n * Returns a list of supported BCP 47 language tags.\n */\n getSupportedLanguages(): Promise<{ languages: string[] }>;\n /**\n * Returns a list of supported voices.\n */\n getSupportedVoices(): Promise<{ voices: SpeechSynthesisVoice[] }>;\n /**\n * Checks if a specific BCP 47 language tag is supported.\n */\n isLanguageSupported(options: {\n lang: string;\n }): Promise<{ supported: boolean }>;\n /**\n * Verifies proper installation and availability of resource files on the system.\n *\n * Only available for Android.\n */\n openInstall(): Promise<void>;\n}\n\nexport interface TTSOptions {\n /**\n * The text that will be synthesised when the utterance is spoken.\n *\n * @example \"Hello world\"\n */\n text: string;\n /**\n * The language of the utterance.\n * Possible languages can be queried using `getSupportedLanguages`.\n *\n * @default \"en-US\"\n */\n lang?: string;\n /**\n * The speed at which the utterance will be spoken at.\n *\n * @default 1.0\n */\n rate?: number;\n /**\n * The pitch at which the utterance will be spoken at.\n *\n * @default 1.0\n */\n pitch?: number;\n /**\n * The volume that the utterance will be spoken at.\n *\n * @default 1.0\n */\n volume?: number;\n /**\n * The index of the selected voice that will be used to speak the utterance.\n * Possible voices can be queried using `getSupportedVoices`.\n */\n voice?: number;\n /**\n * Select the iOS Audio session category.\n * Possible values: `ambient` and `playback`.\n * Use `playback` to play audio even when the app is in the background.\n *\n * Only available for iOS.\n *\n * @default \"ambient\"\n */\n category?: string;\n}\n\n/**\n * The SpeechSynthesisVoice interface represents a voice that the system supports.\n */\nexport interface SpeechSynthesisVoice {\n /**\n * Specifies whether the voice is the default voice for the current app (`true`) or not (`false`).\n *\n * @example false\n */\n default: boolean;\n /**\n * BCP 47 language tag indicating the language of the voice.\n *\n * @example \"en-US\"\n */\n lang: string;\n /**\n * Specifies whether the voice is supplied by a local (`true`) or remote (`false`) speech synthesizer service.\n *\n * @example true\n */\n localService: boolean;\n /**\n * Human-readable name that represents the voice.\n *\n * @example \"Microsoft Zira Desktop - English (United States)\"\n */\n name: string;\n /**\n * Type of URI and location of the speech synthesis service for this voice.\n *\n * @example \"urn:moz-tts:sapi:Microsoft Zira Desktop - English (United States)?en-US\"\n */\n voiceURI: string;\n}\n"]}
@@ -18,7 +18,7 @@ import Capacitor
18
18
  self.resolveCurrentCall()
19
19
  }
20
20
 
21
- @objc public func speak(_ text: String, _ lang: String, _ rate: Float, _ pitch: Float, _ category: String, _ volume: Float, _ voice : Int, _ call: CAPPluginCall) throws {
21
+ @objc public func speak(_ text: String, _ lang: String, _ rate: Float, _ pitch: Float, _ category: String, _ volume: Float, _ voice: Int, _ call: CAPPluginCall) throws {
22
22
  self.synthesizer.stopSpeaking(at: .immediate)
23
23
 
24
24
  var avAudioSessionCategory = AVAudioSession.Category.ambient
@@ -37,11 +37,11 @@ import Capacitor
37
37
  utterance.pitchMultiplier = pitch
38
38
  utterance.volume = volume
39
39
 
40
- //Find the voice associated with the voice parameter if a voice specified.
41
- //If the specified voice is not available we will fall back to default voice rather than raising an error.
42
- if (voice >= 0) {
40
+ // Find the voice associated with the voice parameter if a voice specified.
41
+ // If the specified voice is not available we will fall back to default voice rather than raising an error.
42
+ if voice >= 0 {
43
43
  let allVoices = AVSpeechSynthesisVoice.speechVoices()
44
- if (voice < allVoices.count) {
44
+ if voice < allVoices.count {
45
45
  utterance.voice = allVoices[voice]
46
46
  }
47
47
  }
@@ -61,10 +61,10 @@ public class TextToSpeechPlugin: CAPPlugin {
61
61
  "localService": true,
62
62
  "name": voice.name,
63
63
  "voiceURI": voice.identifier
64
- ] as [String : Any]
64
+ ] as [String: Any]
65
65
  res.append(lang)
66
66
  }
67
-
67
+
68
68
  call.resolve([
69
69
  "voices": res
70
70
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/text-to-speech",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "description": "Capacitor plugin for synthesizing speech from text.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -26,11 +26,11 @@
26
26
  "author": "Robin Genz <mail@robingenz.dev>",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@capacitor/android": "4.0.1",
30
- "@capacitor/cli": "4.0.1",
31
- "@capacitor/core": "4.0.1",
29
+ "@capacitor/android": "5.0.0",
30
+ "@capacitor/cli": "5.0.0",
31
+ "@capacitor/core": "5.0.0",
32
32
  "@capacitor/docgen": "0.2.0",
33
- "@capacitor/ios": "4.0.1",
33
+ "@capacitor/ios": "5.0.0",
34
34
  "@ionic/eslint-config": "0.3.0",
35
35
  "@ionic/prettier-config": "1.0.1",
36
36
  "@ionic/swiftlint-config": "1.1.2",
@@ -44,7 +44,7 @@
44
44
  "typescript": "4.1.5"
45
45
  },
46
46
  "peerDependencies": {
47
- "@capacitor/core": "^4.0.0"
47
+ "@capacitor/core": "^5.0.0"
48
48
  },
49
49
  "files": [
50
50
  "android/src/main/",