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

react-native-speech-to-text-ios

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-speech-to-text-ios

React Native speech recognition component for iOS 10+

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-38.89%
Maintainers
1
Weekly downloads
 
Created
Source

alt tag

react-native-speech-to-text-ios npm version

React Native speech recognition component for iOS 10+

Getting started

$ npm install react-native-speech-to-text-ios --save

Mostly automatic installation

$ react-native link react-native-speech-to-text-ios

IMPORTANT xCode plist settings

Also, you need open the React Native xCode project and add two new keys into Info.plist Just right click on Info.plist -> Open As -> Source Code and paste these strings somewhere into root <dict> tag

<key>NSSpeechRecognitionUsageDescription</key>
<string>Your usage description here</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your usage description here</string>

Application will crash if you don't do this.

Usage


import {
  ...
  NativeAppEventEmitter,
  ...
} from 'react-native';

var SpeechToText = require('react-native-speech-to-text-ios');

...

this.subscription = NativeAppEventEmitter.addListener(
  'SpeechToText',
  (result) => {

    if (result.error) {
      alert(JSON.stringify(result.error));
    } else {
      console.log(result.bestTranscription.formattedString);
    }
	
  }
);

SpeechToText.startRecognition("en-US");

...

componentWillUnmount() {
  if (this.subscription != null) {
    this.subscription.remove();
    this.subscription = null;
  }
}

To stop recording call SpeechToText.finishRecognition() but after that you can continue to receive event with final recognition results. The events will not arrive after result.isFinal == true. Call SpeechToText.stopRecognition() to cancel current recognition task. The result objects reflects Apple SFSpeechRecognitionResult class.

Use this link to reference error codes https://developer.nuance.com/public/Help/DragonMobileSDKReference_iOS/Error-codes.html

Keywords

FAQs

Package last updated on 28 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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