Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor-community/text-to-speech

Package Overview
Dependencies
Maintainers
27
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/text-to-speech - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1-dev.63108ab

dist/plugin.cjs.js

6

dist/esm/definitions.d.ts

@@ -1,2 +0,2 @@

declare module "@capacitor/core" {
declare module '@capacitor/core' {
interface PluginRegistry {

@@ -26,4 +26,4 @@ TextToSpeech: TextToSpeechPlugin;

locale?: string;
rate?: number;
pitch?: number;
speechRate?: number;
pitchRate?: number;
volume?: number;

@@ -30,0 +30,0 @@ voice?: number;

@@ -1,3 +0,3 @@

import { WebPlugin } from "@capacitor/core";
import { TextToSpeechPlugin, TTSOptions, SpeechSynthesisVoice } from "./definitions";
import { WebPlugin } from '@capacitor/core';
import { TextToSpeechPlugin, TTSOptions, SpeechSynthesisVoice } from './definitions';
export declare class TextToSpeechWeb extends WebPlugin implements TextToSpeechPlugin {

@@ -4,0 +4,0 @@ private speechSynthesizer;

@@ -1,9 +0,9 @@

import { WebPlugin } from "@capacitor/core";
import { WebPlugin } from '@capacitor/core';
export class TextToSpeechWeb extends WebPlugin {
constructor() {
super({
name: "TextToSpeech",
platforms: ["web"],
name: 'TextToSpeech',
platforms: ['web'],
});
this.notSupportedMessage = "Speech Synthesizer is not yet initialized or supported.";
this.notSupportedMessage = 'Speech Synthesizer is not yet initialized or supported.';
this.supportedVoices = [];

@@ -21,10 +21,10 @@ if (!this.speechSynthesizer && window && window.speechSynthesis) {

if (!options) {
reject("No options were provided.");
reject('No options were provided.');
return;
}
if (!options.text) {
reject("Text option was not provided");
reject('Text option was not provided');
return;
}
const { text, locale, rate, volume, voice, pitch } = options;
const { text, locale, speechRate, volume, voice, pitchRate } = options;
if (!this.activeUtterance) {

@@ -34,7 +34,9 @@ this.activeUtterance = new SpeechSynthesisUtterance();

this.activeUtterance.voice = this.supportedVoices[voice];
this.activeUtterance.rate = rate >= 0.1 && rate <= 10 ? rate : 1;
this.activeUtterance.rate =
speechRate >= 0.1 && speechRate <= 10 ? speechRate : 1;
this.activeUtterance.volume = volume >= 0 && volume <= 1 ? volume : 1;
this.activeUtterance.text = text;
this.activeUtterance.lang = locale;
this.activeUtterance.pitch = pitch >= 0 && pitch <= 2 ? pitch : 2;
this.activeUtterance.pitch =
pitchRate >= 0 && pitchRate <= 2 ? pitchRate : 2;
if (voice) {

@@ -87,11 +89,11 @@ this.activeUtterance.voice = voice;

openInstall() {
throw new Error("Method not implemented.");
throw new Error('Method not implemented.');
}
setPitchRate(_options) {
// Pitch rate cannot be set while engine is active
throw new Error("Method not implemented.");
throw new Error('Method not implemented.');
}
setSpeechRate(_options) {
// Speech rate cannot be set while engine is active
throw new Error("Method not implemented.");
throw new Error('Method not implemented.');
}

@@ -101,4 +103,4 @@ }

export { TextToSpeech };
import { registerWebPlugin } from "@capacitor/core";
import { registerWebPlugin } from '@capacitor/core';
registerWebPlugin(TextToSpeech);
//# sourceMappingURL=web.js.map
{
"name": "@capacitor-community/text-to-speech",
"version": "0.2.0",
"description": "A native plugin for text to speech engine",
"main": "dist/esm/index.js",
"version": "0.2.1-dev.63108ab",
"description": "Capacitor plugin for synthesizing speech from text.",
"main": "dist/plugin.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"build": "npm run clean && tsc",
"lint": "npm run prettier -- --check && npm run swiftlint -- lint",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"build": "npm run clean && tsc && rollup -c rollup.config.js",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"npm-publish": "np"
"release": "standard-version"
},
"author": "Priyank Patel <priyank.patel@stackspace.ca>",
"contributors": [
"Priyank Patel <priyank.patel@stackspace.ca>",
"Robin Genz <mail@robingenz.dev>"
],
"license": "MIT",

@@ -20,21 +27,20 @@ "dependencies": {

"devDependencies": {
"@capacitor/android": "latest",
"@capacitor/ios": "latest",
"husky": "^4.2.5",
"np": "^6.2.4",
"prettier": "^2.0.5",
"prettier-plugin-java": "^0.8.0",
"pretty-quick": "^2.0.1",
"rimraf": "^3.0.2",
"typescript": "^3.9.5"
"@capacitor/android": "2.4.7",
"@capacitor/core": "2.4.7",
"@capacitor/ios": "2.4.7",
"@ionic/prettier-config": "1.0.1",
"@ionic/swiftlint-config": "1.1.2",
"prettier": "2.0.5",
"prettier-plugin-java": "0.8.3",
"rimraf": "3.0.2",
"rollup": "2.21.0",
"standard-version": "9.1.0",
"swiftlint": "1.0.1",
"typescript": "3.9.5"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"files": [
"android/src/main/",
"android/build.gradle",
"dist/",
"ios/",
"android/",
"ios/Plugin/",
"CapacitorCommunityTextToSpeech.podspec"

@@ -55,3 +61,4 @@ ],

},
"homepage": "https://github.com/capacitor-community/text-to-speech",
"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"repository": {

@@ -58,0 +65,0 @@ "type": "git",

@@ -5,8 +5,8 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>

<p align="center">
Capacitor community plugin for native <a href="https://firebase.google.com/docs/crashlytics">Firebase Crashlytics</a>.
Capacitor community plugin for synthesizing speech from text.
</p>
<p align="center">
<img src="https://img.shields.io/maintenance/yes/2020?style=flat-square" />
<a href="https://github.com/capacitor-community/text-to-speech/actions?query=workflow%3A%22Test+and+Build+Plugin%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/text-to-speech/Test%20and%20Build%20Plugin?style=flat-square" /></a>
<img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" />
<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>
<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>

@@ -17,3 +17,3 @@ <br>

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-3-orange?style=flat-square" /></a>
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-1-orange?style=flat-square" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->

@@ -24,31 +24,16 @@ </p>

| Maintainer | GitHub | Social |
| ------------- | ------------------------------------------- | ------------------------------------------------ |
| Priyank Patel | [priyankpat](https://github.com/priyankpat) | [@priyankpat\_](https://twitter.com/priyankpat_) |
| Maintainer | GitHub | Social |
| ---------- | ----------------------------------------- | --------------------------------------------- |
| Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |
Mainteinance Status: Actively Maintained
## Installation
To use npm
```bash
npm install @capacitor/text-to-speech
```
To use yarn
```bash
yarn add @capacitor/text-to-speech
```
Sync native files
```bash
npm install @capacitor-community/text-to-speech
npx cap sync
```
On iOS, no further steps are needed.
On **iOS**, no further steps are needed.
On Android, register the plugin in your main activity:
On **Android**, register the plugin in your main activity:

@@ -99,5 +84,5 @@ ```java

// Must import the package once to make sure the web support initializes
import "@capacitor-community/text-to-speech";
import '@capacitor-community/text-to-speech';
import { Plugins } from "@capacitor/core";
import { Plugins } from '@capacitor/core';

@@ -118,4 +103,4 @@ const { TextToSpeech } = Plugins;

TextToSpeech.speak({
text: "This is a sample text.",
locale: "en_US",
text: 'This is a sample text.',
locale: 'en_US',
speechRate: 1.0,

@@ -125,3 +110,3 @@ pitchRate: 1,

voice: 10,
category: "ambient",
category: 'ambient',
});

@@ -181,1 +166,9 @@

```
## Changelog
See [CHANGELOG.md](https://github.com/capacitor-community/text-to-speech/blob/master/CHANGELOG.md).
## License
See [LICENSE](https://github.com/capacitor-community/text-to-speech/blob/master/LICENSE).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc